Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem was related to using epoll-shim, which relies on the kqueue() function. If you review the documentation for kqueue(), you will see that it states the following: "The kqueue() system call creates a new kernel event queue and returns a descriptor. The queue is not inherited by a child created with fork(2)". It is easy to verify this using the following code:
Output:
It is worth noting that in KPHP, we use the prefork model. In this model, the main process, or master, first creates all necessary resources, such as file descriptors. Then, the process calls the fork function to create several child processes, controlled by the "-f" flag. The resulting file descriptor numbers are used as indexes for the "Targets" array, which stores references to event handler functions. This means that when the accept() call is made in the worker process, it cannot find the desired function in the "Targets" array because all workers have different file descriptor offsets.
I understand that this may not be the most elegant solution, but it is simple and effective.