-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Reduce max sigma for sharpen operation #3521
Comments
Hi, thanks for reporting this. I can reproduce using Downloading the test file:
Running with default concurrency (4 in this example):
Running with a forced concurrency of 36:
Running with a concurrency of 4 via callgrind:
produces the following output:
Running with a concurrency of 36 via callgrind:
So this looks a bit like over-computation based on increased concurrency. The behaviour of libvips 8.13 and 8.14 (and latest master) appears to be similar, so probably not related to any recent changes. @jcupitt Do you have any insights here? |
Wow sigma 100 on sharpen seems a lot. I think 1.5 is probably the highest value that would make sense (in my experience). It's not really designed to scale to values that high. Could you explain why you need such a huge sigma? |
I tried this with your test image:
So yes, RSS does get hilariously out of control for large values, unfortunately. It looks like it's slightly worse than linear: It might be possible to improve the scaling. |
Thanks @jcupitt, would it make sense to reduce the accepted range for |
Yes, maybe 0.001 to 10 would be better? (sigma is related to display resolution -- you need about 0.5 for an 80 DPI display (typical desktop screen), or 1.5 for 300 DPI (typical high quality print)) |
@kleisauke something for your backlog :) |
sharpen
Commit 081debd reduces the maximum sigma to 10 in sharp. I've left the existing minimum as-is for now. I'll open a separate PR for libvips (for 8.15 as it'll be a breaking change). |
v0.32.0 now available with this new limit. |
Question about an existing feature
What are you trying to achieve?
I'm using
sharpen
withsigma: 100
on apng
image(attached below). While doing this operation the RSS size keeps on increasing after which the process is OOM Killed. The OOM Kill is understandable as I've restricted the container's memory to 1.5GB. How can I fix this?When you searched for similar issues, what did you find that might be related?
I'm running on Alpine Linux with
musl libc
. I found out that this could be an issue with the underlying memory allocator, hence changed the default memory allocator tomimalloc
. I've also confirmed that NodeJs process is usingmimalloc
, with the following commands:cat /proc/1/smaps | grep malloc
:ldd $(which node) | grep malloc
:I also tried this test with
jemalloc
on Debian, but the same results.I'm running on
c4.8xlarge
EC2 instance, with sharp concurrency as36
.I know that lowering the concurrency could help because I tested it with concurrency
20
and it worked. However, I don't believe that is a robust solution because I assume it could then break for a larger image.Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
The test I'm running:
I log the memory usage at regular intervals. The tests starts with this:
...and ends here:
Also, here's the output of
npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp
:Please provide sample image(s) that help explain this question
The text was updated successfully, but these errors were encountered: