-
-
Notifications
You must be signed in to change notification settings - Fork 133
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
Static embedded php build - Segmentation fault(s) #634
Comments
To set your expectations, I'm probably only going to be able to point you where to look, rather than investigate it for you, as:
that's pretty much how the library is meant to be used. So, you'll need to step through the thing that is actually segafaulting:
Which, in the current version of ImageMagick looks like this. I'm guessing the segfault is in LockSemaphoreInfo(). The fundamental problem you're probably seeing is ImageMagick makes assumptions about it being run in a single threaded environment, and that it will manage it's own threading/forking. Probably what's happening is that just some assumption in the code is not valid, and so....segfaults. I'd suggest:
Anyway, will be interested to see what you find out. |
Thank you for the reply!
As an unfortunate addition to 1), using slightly different code unfortunately crashes in different parts of cache.c, so I'm not entirely sure it's related. |
Thread 13 "frankenphp" hit Breakpoint 5, GetPolicyInfo (name=name@entry=0x5d1da1b "*",
exception=exception@entry=0x7fffb0791c10) at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) c
Continuing.
Thread 13 "frankenphp" hit Breakpoint 5, GetPolicyInfo (name=name@entry=0x5d1da1b "*",
exception=exception@entry=0x7fffb0791b50) at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) c
Continuing.
Thread 13 "frankenphp" hit Breakpoint 5, GetPolicyInfo (name=name@entry=0x5d7acf3 "cache:synchronize",
exception=exception@entry=0x7fffb0791bd0) at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) s
Thread 13 "frankenphp" received signal SIGSEGV, Segmentation fault.
GetPolicyInfo (name=name@entry=0x5d7acf3 "cache:synchronize", exception=exception@entry=0x7fffb0791bd0)
at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) s
Thread 13 "frankenphp" hit Breakpoint 5, GetPolicyInfo (name=name@entry=0x5d7acf3 "cache:synchronize",
exception=exception@entry=0x7fffb0791bd0) at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) s
Thread 13 "frankenphp" received signal SIGSEGV, Segmentation fault.
GetPolicyInfo (name=name@entry=0x5d7acf3 "cache:synchronize", exception=exception@entry=0x7fffb0791bd0)
at MagickCore/policy.c:301
301 if (IsPolicyCacheInstantiated(exception) == MagickFalse)
(gdb) s
Couldn't get registers: No such process.
Couldn't get registers: No such process. Seems to segfault right on the function call, can't even step into it like I could with the previous calls to |
Maybe it's possible that That bit of code is passing when name is "*" and failing when it's "cache:synchronize". Can you run it again, get the code to that line with name being "cache:synchronize" and then: i. Print out the backtrace with the command 'bt'. ii. Print out the registers with 'i r' apparently https://bob.cs.sonoma.edu/IntroCompOrg-RPi/sec-gdb2.html iii. Switch to an assembly view And then copy+paste those to here....not sure they'll actually provide any info, but they might. |
Actually, probably even simpler, maybe recompile ImageMagick with some printf's before each of the lines in the function IsPolicyCacheInstantiated as that can be a quicker way of finding out exactly where a fault occurs. I usually use something like:
to configure ImageMagick. |
Hmm, it shouldn't get inlined with -O0, but I can disable inlining to make sure. And add some prints.
Same backtrace as above.
Will try tomorrow. |
It was recommended to forward the issue here.
Attempting to use Imagick embedded to FrankenPHP leads to all kinds of segfaults with even very simple programs.
E.g. magick.php:
Important: Using the php-cli binary that was generated with the same
./php-src/configure
command works with no problems.Console log example using crazyccwhale/static-php-cli and dunglas/frankenphp :
Important parts:
This was using gcc 12.2.1, but using gcc 11.3.0 results in the same error.
The text was updated successfully, but these errors were encountered: