-
Notifications
You must be signed in to change notification settings - Fork 27
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
Fix CI #237
Fix CI #237
Conversation
Ooop! We crossed over. I'll reenable 8.3. |
I made a dockerfile for local testing: https://github.com/jcupitt/docker-builds/tree/master/php-vips-php8.3 I tried some different values for the php max stacksize, but it fails with even 100gb, hilariously:
But using -1 works fine and (obviously) does not use that much stack. Perhaps php 8.3.0 is not detecting stack overflow correctly for closures? |
@uuf6429 can I ping you on this? Any ideas? |
@dmitryuk I think this mystery is the only thing blocking a new release. If you have any ideas ... |
Quick summary for anyone who hasn't been following this:
It looks like a stack overflow is being detected in the https://github.com/libvips/php-vips/blob/master/src/GObject.php#L203 It's when that closure is invoked (before any code runs). Kleis discovered that adding:
(ie. no max stack size) to |
PR php/php-src#12823 might be relevant here. Specifically comment php/php-src#12823 (comment) which mentions that the stack tracking code won't work for FFI callbacks that are called from non-main threads. |
I agree, that sounds like the issue --- callbacks happening off the main thread. Good find! I don't think we can work around this one easily. I suppose we'll need to add if (PHP_MAJOR_VERSION >= 8 && PHP_MINOR_VERSION >= 3) {
$stacksize = ini_get('zend.max_allowed_stack_size');
if ($stacksize != '-1') {
throw new Exception("zend.max_allowed_stack_size not set to '-1'");
}
} in startup? |
.... I added a version of that check, and updated the README. |
I'm sorry, I was also clueless at that point. The problem seemed to happen only for PHP resources being tested. I started looking at PHP's FFI implementation and then kinda gave up after finding and fixing the (easy) assertion stuff. 😅 It might help to get someone from room 11 to look into it.
I think the check you propose is a reasonable one. The only sane solution is that you keep the check as is, but support disabling it with a flag, e.g.: class FFI {
/**
* <some useful description>
*/
public static $checkMaxStackSize = true;
...
if (self::$checkMaxStackSize && version_compare(PHP_VERSION, '8.3', '>=') &&
ini_get('zend.max_allowed_stack_size') != '-1') {
throw new Exception("zend.max_allowed_stack_size not set to '-1'");
} Alternatively, but it might be too much, you could postpone that check to where it is really needed - so it doesn't fully block everyone. PS: It might be useful to mention this GH issue number in the exception message. |
If PHP fix this in 8.4 or 8.5, we can do a new php-vips with a range check, so I think it's OK. This code will still work even if php fix the bug, it'll just mean people have to add a line to their |
I asked for second opinions in room11 btw |
@jcupitt I like to ask if we could add the check. I'm happily using your library in one of my projects with PHP 8.3. Unfortunately I can't change the ini value and it's not possible to temporary change it on runtime. |
@ckilb AFAIK, this issue occurs only in That said, I can confirm that this issue persists in PHP 8.3 and the upcoming 8.4 release, see: |
@kleisauke You're right, I neither use |
PR #261 moves this |
Temporary workaround, feel free to debug further.