-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
User stream filter segfault in uopz_find_return during request shutdown #155
Comments
This might be related to https://bugs.php.net/bug.php?id=75931. |
That does seem related, although this doesn't crash under PHP 7.3 + uopz. |
This obvious and rather crude fix prevents the segfault: diff --git a/src/return.c b/src/return.c
index baf59ed..16bd2c2 100644
--- a/src/return.c
+++ b/src/return.c
@@ -132,6 +132,10 @@ uopz_return_t* uopz_find_return(zend_function *function) { /* {{{ */
return NULL;
}
+ if ((EG(flags) & EG_FLAGS_IN_SHUTDOWN)) {
+ return NULL;
+ }
+
if (function->common.scope) {
returns = zend_hash_find_ptr(&UOPZ(returns), function->common.scope->name);
} else { Is there a better way? That hashtable is no longer around at the point we hit this user filter callback, so trying to look up return overrides at that point won't work. |
I think that's the best we can do, committed to both hook and return code, thanks. |
Here is an interesting backtrace. Ignore the top 4 frames. It is the annoying signal handler in libGraphicsMagick, but it isn't affecting the outcome here.
I don't have a small reproduce case yet, but looking at the backtrace, could this be a shutdown order thing? On request shutdown it is trying to close and flush a stream with a userspace filter function. In userspace the crash happens on the
stream_bucket_make_writeable()
call in this:The text was updated successfully, but these errors were encountered: