-
Notifications
You must be signed in to change notification settings - Fork 305
Expand php-wasm/node multi-worker support to Asyncify builds #2317
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
base: trunk
Are you sure you want to change the base?
Conversation
I am encountering a null-or-signature-mismatch error here: The line is this, the ZEND_API void ZEND_FASTCALL rc_dtor_func(zend_refcounted *p)
{
ZEND_ASSERT(GC_TYPE(p) <= IS_CONSTANT_AST);
zend_rc_dtor_func[GC_TYPE(p)](p);
} I was able to find the GC_TYPE by expanding the refcounted pointer struct while debugging in Cursor. The GH type num was 7, which is an offset in this array: static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
[IS_UNDEF] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_NULL] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_FALSE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_TRUE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_LONG] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_DOUBLE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_STRING] = (zend_rc_dtor_func_t)zend_string_destroy,
[IS_ARRAY] = (zend_rc_dtor_func_t)zend_array_destroy,
[IS_OBJECT] = (zend_rc_dtor_func_t)zend_objects_store_del,
[IS_RESOURCE] = (zend_rc_dtor_func_t)zend_list_free,
[IS_REFERENCE] = (zend_rc_dtor_func_t)zend_reference_destroy,
[IS_CONSTANT_AST] = (zend_rc_dtor_func_t)zend_ast_ref_destroy
}; If the GC type is indeed 7, then it looks like the dtor is |
Any chance it would work on trunk with @mho22 wrapper? Or was that a completely different code path? |
It might! I think it is a different path, but it feels like it could be a similar thing. Will try shortly. :) |
After merging trunk into this branch, I'm still seeing the same issue. Will instrument php-src and see what can be found. |
@adamziel @brandonpayton For the record, my wrapper is only targeting PHP7.4 and PHP7.3 to replace the old
It may be the same issue but Brandon is right, that's a new one. And the
But maybe not, I think
So maybe you'll need to apply a new patch [ to PHP8.4 and PHP8.3 at least ] like this : + static void zend_array_destroy_wrapper(zend_refcounted *p) {
+ HashTable *ht = (HashTable*)p;
+ zend_array_destroy(ht);
+}
static const zend_rc_dtor_func_t zend_rc_dtor_func[] = {
[IS_UNDEF] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_NULL] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_FALSE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_TRUE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_LONG] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_DOUBLE] = (zend_rc_dtor_func_t)zend_empty_destroy,
[IS_STRING] = (zend_rc_dtor_func_t)zend_string_destroy,
- [IS_ARRAY] = (zend_rc_dtor_func_t)zend_array_destroy,
+ [IS_ARRAY] = zend_array_destroy_wrapper
[IS_OBJECT] = (zend_rc_dtor_func_t)zend_objects_store_del,
[IS_RESOURCE] = (zend_rc_dtor_func_t)zend_list_free,
[IS_REFERENCE] = (zend_rc_dtor_func_t)zend_reference_destroy,
[IS_CONSTANT_AST] = (zend_rc_dtor_func_t)zend_ast_ref_destroy
}; I hope this helps. |
Thank you, @mho22. 🙇 This discussion is helpful. Hopefully, we are close to where the problem is. I took a look at the HashTable and zend_array types, and they are both type aliases for the same struct like:
My mental model suggests those types are equivalent and would not conflict, but it would be good to try a wrapper to confirm. Also, maybe there is some other type that is marked with IS_ARRAY that is not a HashTable or zend_array... We'll see! |
Motivation for the change, related issues
We want to be able to use multiple workers in places that don't have JSPI support.
Implementation details
TBD
Testing Instructions (or ideally a Blueprint)
TBD