krakjoe / parallel

A succinct parallel concurrency API for PHP8
Other
1.43k stars 93 forks source link

FrankenPHP: mutex not unlocked in `zend_bailout` case #313

Closed realFlowControl closed 3 days ago

realFlowControl commented 2 weeks ago

parallel replaces the sapi_module.ub_write function with a simple function that locks a mutex, calls whatever was in that function pointer before and upon return unlocks the mutex again. This hanging/freezing happens in the following situation:

The mutex around echo/printf is necessary to make them atomic from a PHP user land perspective. I'll have a look if I can detect a zend_bailout() somehow and release the mutex parallel holds.

Relates to:

dunglas commented 2 weeks ago

Thanks, I'll try to hack Static PHP CLI to see if this fixes this issue this afternoon.

realFlowControl commented 2 weeks ago

PR #314 will unlock the mutex in RSHUTDOWN and seems to solve the problem

dunglas commented 2 weeks ago

ok, let me know when there is a branch ready with all needed patches and I'll give it a try.

realFlowControl commented 2 weeks ago

You can try the florian/deadlock-in-echo branch from #314