Closed AssortedPelican closed 2 years ago
Related to #139
Thanks for the reproduction. It looks like building libvips with -Wl,-z,nodelete
fixes this, see for more info:
https://github.com/libvips/php-vips-ext/pull/44
Here's an adapted Dockerfile that seems to work for me:
@jcupitt Should we link libvips by default with -Wl,-z,nodelete
, if supported? I could open a PR for that.
Oh yes, I'd forgotten about nodelete
.
Sure, let's do it!
I just opened https://github.com/libvips/php-vips/pull/151 to fix var_dump()
of instances (which was broken on v2.0.3), and https://github.com/libvips/libvips/pull/2934 to prevent unloading.
Well done for finding and fixing these issues Kleis!
@AssortedPelican, @lucasnetau would you be able to test again?
@jcupitt Testing now, so far no errors. Will stress a bit further.
Great! Here's another Dockerfile using https://github.com/kleisauke/elf-set-nodelete to set RTLD_NODELETE
on ELF files. This could be an alternative if you couldn't compile libvips yourself. However, patching ELF files could be a bit dangerous, so use it at your own risk.
Have not been able to trigger the GLib errors previously seen under repeated stress testing. Looks great. Will this land in the 8.13 release?
Great! Yes, this is in 8.13.
libvips 8.13 was released, see: https://github.com/libvips/libvips/releases/tag/v8.13.0.
We're trying to use the latest version from Packagist (2.0.1) on Debian 11 with PHP 7.4. Unfortunately, we ran into some issues where the FPM processes would freeze or crash when calling into libvips.
A simple test script calling
\Jcupitt\Vips\Image::newFromArray()
is sufficient to reproduce the issue. It works fine when running the script multiple times from the command line, but when running in PHP-FPM, it only works the first time, and subsequent requests will freeze or crash the PHP process.The issue appears to have something to do with libvips and the related GLib types being initialized multiple times. On the CLI, a fresh PHP process is created for each run of the script, but PHP-FPM uses long running processes, and a subsequent request may cause libvips to be initialized again.
We have a repository containing a docker-compose setup which may be used to reproduce this bug. Simply running
docker-compose up
in the cloned repository, then navigating tohttp://localhost:8080/
should display avar_dump()
of anImage
object. Refreshing the page causes the FPM process to hang, eventually resulting in a HTTP 504 Gateway Timeout error. On the command line, the following errors appear: