-
-
Notifications
You must be signed in to change notification settings - Fork 855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default MemoryAllocator creation crashes on Raspberry Pi OS 11 #2001
Comments
Based on the stack trace, the issue is not with @mcrossley any chance you can pull down the ImageSharp source and try a debug build on the device to see which line fails exactly? I don't have a PI, and I don't see which arithmetic operations can overflow in UniformUnmanagedMemoryPool constructor, so this is going to be hard to address without community help. |
@antonfirsov My money is here. ImageSharp/src/ImageSharp/Memory/Allocators/UniformUnmanagedMemoryPoolMemoryAllocator.cs Lines 70 to 72 in f24b02f
Since |
Yeah but that would mean that the stack trace is lying for some reason. Nothing is impossible though. |
@mcrossley what is the value returned by |
Thanks folks. Here is the position, the error is occurring with one of my testers, he has a latest model 4 rPi with Bullseye. My main program is a bit hefty at 90k lines of source, and it only calls ImageSharp once an hour. So I will create a test harness, download the ImageSharp source, add a test for TotalAvailableMemoryBytes and run the debug version on my pi. If I cannot reproduce on a rPi 3, then it will have to go to my test user - don't you love debugging by email! That will take me a a couple of days or so to achieve, so do not worry if I go quiet for a little while - I have a day job! |
Good luck! |
OK, I made a simple test program, and built a debug version of ImageSharp (as of commit v2.0.0)...
I loaded Bullseye on my pi 3 and the the test program ran OK.
I got my test user to run it on his pi4 and it crashed...
Looks like TotalAvailableMemoryBytes is overflowing somewhere where they haven't used a long. |
Also this closed bug on dotnet running on ARM32: |
@mcrossley is this Pi4 with the issue ARM32 or ARM64? In the dotnet runtime issue they state its only happening on ARM32. |
Looking at the last log file from my app that he sent me - ARM32... |
As it works on my ARM32 pi3 with 2GB memory, it looks like an overflow in the OS at 4GB of memory? |
Sorry, I do not know how to link to the source, but is UniformUnmangedPoolMemoryAllocator.cs the source of the issue within IS, obviously it is getting duff data from the OS, but...
As we are now running .NET 6.0 |
I was able to reproduce the issue now with docker. I tried it yesterday, but with ARM64 images, which do not seem to be affected. I tried the following official dotnet sdk images:
(note: running those images does not work when the host CPU is x64 as far as i know) All report Not sure why DotNetIssue13115 was closed. It seems now locked, I cannot comment there anymore. |
Seems like they closed it because the test failure somehow stopped to occur in dotnet/runtime CI. @brianpopow if you can provide very clear repro steps I think we are a good position to open a new issue against the runtime. We can link both this issue and dotnet/runtime#13115. Can you do it? In the meanwhile, I believe we can easily workaround this in ImageSharp. |
Yes, I can do that. Will do that tomorrow. edit: issue opened: dotnet/runtime#65466 |
ImageSharp version
2.0.0.0
Other ImageSharp packages and versions
None
Environment (Operating system, version and so on)
Raspberry Pi OS 11 - Bullseye - 5.10.92.7
.NET Framework version
6.0.1
Description
A memory allocation error during Image.Load() when running on Raspberry Pi OS 11 Bullseye 5.10.92
Note that the same code works without error on Raspberry Pi OS 10 Buster 5.10.63.
Version 1 of ImageSharp works OK on both OS versions.
As ImageSharp only processes that one image periodically I also tried globally fixing the MaximumPoolSizeMegabytes to 1 MB, this made no difference.
Steps to Reproduce
Simply calling...
using var bmp = Image.Load<Rgba32>("./web/MoonBaseImage.png");
gives...
If I catch the Image.Load() error and bypass the image processing completely, then a short while later whist the program is running I get another exception...
The text was updated successfully, but these errors were encountered: