-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ensure extension is linked with -Wl,-z,nodelete
#44
Conversation
Wow I'd never heard of This comment talks about the scenario which caused graceful to fail: So it sounds like locking libvips in memory ought to fix it, since it will no longer restart without restarting glib. However, I've no idea what platforms like BSD and macOS do with Perhaps the problem is that libvips and the vips.so extension are not using the same linker flags as glib? It's because they differ that we are seeing one library restarting and not the other. Maybe I'd think |
I did a quick search, but it seems that on macOS
I think the non-matching linker flags could be the underlying issue. Unfortunally, the |
I have a macOS machine for testing, I'll test this. Yes, it's complex issue. You'd think other libraries which use glib would have been bitten by this. I'll ask the glib maintainers if they have an opinion. |
I opened an issue on glib: https://gitlab.gnome.org/GNOME/glib/-/issues/2483 |
What is strange (to me) is that the discussion is about the mod_php case. But the segfault also happens in CLI (running the test suite), with a single process...
|
Yes, this solves the issue in CLI mode (cleanup occurs before the library is unloaded) |
I think the issue is related to
|
I suppose we also need to link The conclusion from the glib devs seems to be that we should copy-paste the glib linker logic from their I think the |
The curious thing is that I saw the same segfault when Perhaps I didn't test carefully, let me check it again. |
I can confirm that (on the master branch of php-vips-ext):
I also confirm that with this PR the segfault is no longer present with or without applying the above changes. |
No
Yes |
This workaround isn't necessary on macOS, and specific to ELF libraries only. Although $ podman create --arch=amd64 --os=darwin -ti --name dummy ghcr.io/homebrew/core/vips:8.12.0 sh
$ podman export dummy > homebrew-vips.tar
$ podman rm -f dummy
$ tar -xf homebrew-vips.tar vips/8.12.0/include/vips/soname.h --strip-components 4
$ cat soname.h
/* This file is autogenerated, do not edit. */
#define VIPS_SONAME "libvips.42.dylib"
This PR is ready for reviewing now. Note that issue #43 is already resolved within libvips 8.12, since we no longer call |
OK, LGTM. Good job everyone for investigating and fixing this. |
As discussed in #43, this ensures that the extension is linked with
-Wl,-z,nodelete
. An advantage of doing this is that theapachectl graceful
workaround introduced in commit d5e34e8 and ed9f424 is probably no longer needed.The removal of the
apachectl graceful
workaround was verified with this Dockerfile (since I couldn't reproduce that behavior locally with version 1.0.2 of the extension).Details
Note that I'm not sure if linking with
-Wl,-z,nodelete
may cause undesirable side effects (it's probably fine since the whole of GLib is linked with this flag).Marked this PR as a draft due to these TODO-items:
apachectl graceful
workaround only for Linux? If not, we may need to verify whether this PR also works on macOS.vips_shutdown
inPHP_MSHUTDOWN_FUNCTION
?