-
Notifications
You must be signed in to change notification settings - Fork 27
Apache graceful causes zombie processes when vips module loaded #26
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
Comments
Jesse, I think the I have no idea on the cause of the GLib error in apache restart, however. |
Hey @jesseforrest, thanks for the bug report, that's very detailed. The critical thing looks like the gobject error. It looks as if php-vips is being unloaded, but the gobject library under that is not. When php-vips is reloaded it tries to init gobject again, and fails. There's supposed to be logic to prevent double-inits of gobject, but it's obviously not working in this case. I'll see if I can reproduce your error here. @ehongyu, you're right, you only need one libvips. php-vips needs vips 8.2 or later and I think the one in Ubuntu 14.04 is 7.38, or maybe even earlier. I would remove the Ubuntu libvips package and just use the one built from source. Have two installed should be fine, but unless you are careful with the paths they can get confused, and that will lead to a range of mysterious crashes. |
I tried on my Ubuntu 16.10 laptop. I did:
I added I wrote this tiny test page: <?php
echo "Hello world!<br>\n";
$filename = "k2.jpg";
$x = vips_image_new_from_file($filename)["out"];
if(!$x) {
echo "failed to open image<br>\n";
echo "vips error log is " . vips_error_buffer() . "\n<br>";
}
else {
$width = vips_image_get($x, "width")["out"];
echo "image " . $filename . " is " . $width . " pixels across\n";
}
?> And I can view the page in my browser:
If I now do
Now Anyway, I agree this is a problem and I can reproduce it. I'll investigate. |
Thanks, @jcupitt, I can see the error message in the Apache error log file :
|
I've been doing some more digging, and it seems to be related to prefork. The stack is apache loading As apache starts up, it loads On The main process also does MSHUTDOWN, then unloads Now when libvips starts up again, it thinks it is starting afresh and tries to rebuild everything. It all clashes and breaks, and then the main process locks. With the main process locked, nothing can collect the exit status from the previous children, and they become defunct. I've tried various combinations of fixes, but not found a working one yet :( I'll keep looking. |
Thanks for the update @jcupitt and for the detailed response. Please let us know if we can help on our end too. |
"apachctl graceful" was failing: we'd lock during restart. This extension was being unloaded, which in turn unloaded libvips (since only we referenced it), but glib was not being unloaded, since other things used by apache were still using it. As a result, on reload of this extension, libvips would try to init, and discover that parts of its previous init were still there, such as the VipsObject type. Fix: lock libvips in memory to prevent unload. See libvips/php-vips#26
Hi again, I think I've found a simple fix: it now just locks libvips in memory to block unload on libvips/php-vips-ext@d5e34e8#diff-b1cc89f7ef630413232cfad4ba9bdbf2R1624 Would you be able to test? There's a |
Thanks @jcupitt -- yeah, we can definitely test this out! Will post back after. |
@jcupitt : I was able to build and install the 1.0.3 package. Everything seems to be working now.
Thank you so much for putting the time into researching/resolving the problem. Is it possible for you to promote 1.0.3 so that when we do a |
Hi, yes, I was waiting for confirmation before making a new version. I'll update the main pecl repository now. Thanks for reporting this issue! |
pecl updated, I'll close. |
I'm not sure if this php-vips project is the most appropriate forum to writeup this bug report, but I'm not sure where else would be appropriate.
We're trying to get Vips to work with:
We tried to follow the guidelines as instructed in the main readme here:
https://github.com/jcupitt/php-vips
In doing so, we were able to get Apache to run appropriately with the Vips C executable, the PECL module, and your php-vips composer package:
Everything works beautifully, except when we run an
apache2ctl graceful
. As soon as we run agraceful
, Apache no longer works and we end up with zombie processes.For example, after provisioning completes, it works and looks healthy:
Then when we run
apache2ctl graceful
, Apache becomes unresponsive and we end up with zombie processes:What's stranger, is that if we simply run
apache2ctl stop
and thenapache2ctl start
, everything looks fine. However, when we deploy to production we need to run agraceful
to make sure we don't kill live requests.When we look at apache error logs, this is the error that appears:
Any help would be appreciated. We would really like to use Vips with PHP 7 on Apache, but unless we can solve this problem it looks to be a deal breaker.
The only other thing we were confused by was whether or not we needed to install libvips by
apt-get install libvips-dev
and/orvips-8.3.3.tar.gz
(from source). The Ansible playbook above does both.Thanks in advance!
The text was updated successfully, but these errors were encountered: