Open uasan opened 7 years ago
This thing is very much unsafe … I definitely wouldn't use it currently :x … I probably should remove that thing altogether here.
That's what ext/pthreads is actually for… Use that, if you need threads in a safe way.
I resolve the cause, this problem in php-ext-raphf
is thread not safe, without it everything works well.
Do not delete uv_queue_work()
function.
Did you try with PHP 7.2? ZTS is broken in PHP 7.0 and 7.1.
# zts-php -v
PHP 7.2.0 (cli) (built: Nov 28 2017 19:54:32) ( ZTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies
_# zts-php test_uv_queuework.php
THREAD-CALL
THREAD-CALL-AFTER
THREAD-CALL
*** Error in `zts-php': double free or corruption (fasttop): 0x00005557c12a77d0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7cbac)[0x7f6b75e1dbac]
/lib64/libc.so.6(+0x87a59)[0x7f6b75e28a59]
/lib64/libc.so.6(cfree+0x16e)[0x7f6b75e2e3be]
zts-php(zend_hash_destroy+0xfa)[0x5557c024ffda]
zts-php(tsrm_free_interpreter_context+0x55)[0x5557c01c57c5]
/usr/lib64/php-zts/modules/uv.so(+0x1e3e9)[0x7f6b72ee43e9]
/usr/lib64/php-zts/modules/uv.so(+0x1e48a)[0x7f6b72ee448a]
/lib64/libuv.so.1(+0x96d4)[0x7f6b72ca96d4]
/lib64/libpthread.so.0(+0x736d)[0x7f6b7776d36d]
/lib64/libc.so.6(clone+0x3f)[0x7f6b75eb1e1f]
...
Aborted (core dumped)
For future reference, I find the issues with other extensions installed.
Having opcache
enabled is the main problem, and using xdebug
too does not play well.
I find segmentation faults really happening on type of variables being referenced in the callbacks. Everything executes as expected, but segfaults when done, like using stream_socket_pair()
As the current Windows version does not do after callbacks, but using uv_async_send
that behavior can be achieved, create a thread queue for the callbacks.
So removing https://github.com/amphp/ext-uv/issues/83 not really a good idea.