-
Notifications
You must be signed in to change notification settings - Fork 61
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
Vips hangs when drawing an image after a fork
call
#396
Comments
Hello @malomalo, libvips is very threaded, so like all threaded libraries, you must be very careful when mixing it with fork. When a process with several running threads forks, none of the threads copy over, instead you will have a new process with a single main thread. mutexes are in an indeterminate state, confusion is everywhere, nothing will work. It's safest to only |
Interesting I'm running into this in my Rails test env when trying to parallelize test. I will look into what is happening before the fork to cause this as error #155 mentions it must be required before the fork Is there anyway to reset vips after a fork perhaps? |
You're right, I'd forgotten all the detail around appkit. No, libvips doesn't support unload and reload, unfortunately. This is an aside, but have you seen |
Ah... We have a Rails gem with an initializer that uses Vips to know image sizes on boot. Then Rails forks for testing and this issue presents itself. Thanks re the |
Because of libvips/ruby-vips#396 and libvips/ruby-vips#155 we'll identify in a fork to allow for forking of the server process in production and/or parrallel testing
ruby-vips
hangs when drawing a image after afork
call.Confirmed on both MacOS 14.2.1 and 13.6.6. Likely also affects linux as our CI system has the same issue.
I've attached the following test file which will hang; once you terminate the script you will also want to terminate the rouge process left behind from the fork.
This might be related to #155, but I don't believe so.
The text was updated successfully, but these errors were encountered: