amphp / cluster

Building multi-core network applications with PHP.
MIT License
60 stars 9 forks source link

Cluster restart problem with UvDriver #20

Open wtsergo opened 4 weeks ago

wtsergo commented 4 weeks ago

Hello,

Can you give me any insight how to debug cluster restart problem when using event loop UvDriver? Here is what I get after restart signal

[2024-11-02T07:51:10.899865+00:00] cluster:cluster.info: Worker 2 terminated cleanly, restarting... {"id":2,"pid":296937} []
[2024-11-02T07:51:10.901305+00:00] cluster:cluster.info: Worker 1 terminated cleanly, restarting... {"id":1,"pid":296935} []
[2024-11-02T07:51:10.939550+00:00] cluster:cluster.info: Started cluster worker with ID 4 {"id":4,"pid":296944} []
php: src/unix/core.c:932: uv__io_stop: Assertion `loop->watchers[w->fd] == w' failed.
Aborted

This doesn't happen with StreamSelectDriver

UPD: I get a bit different error when run your example bin/cluster -w 2 -p cluster-pid examples/cluster/simple-http-server.php then after kill -10 $(cat cluster-pid) I receive in cluster command terminal User defined signal 1

It works only if I run one worker bin/cluster -w 1 -p cluster-pid examples/cluster/simple-http-server.php then restart works as expected.

Again the problem reproducible with UvDriver, with StreamSelectDriver restart works with any number of workers.

UPD2: Different error caused by usage of ThreadContext (in original error ProcessContext was used)

Thank you, Sergey Boyko