Skip to content

Commit

Permalink
Fixing errno after wait (#5218)
Browse files Browse the repository at this point in the history
There is a bug in Swoole's event loop that causes warning messages for things that shouldn't be warnings.
The line "if (errno > 0 && errno != EINTR)" is expecting the global variable "errno" to be set by wait system call in the inline function "wait_process", but instead errno is getting overwritten by the "spawn_task_worker" or "spawn_event_worker methods" of the server.
  • Loading branch information
JacobBrownAustin authored Dec 19, 2023
1 parent bea9c51 commit 307c006
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/server/manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ void Manager::wait(Server *_server) {

while (_server->running) {
ExitStatus exit_status = wait_process();

const auto errnoAfterWait = errno;
if (pool->read_message) {
EventData msg;
while (pool->pop_message(&msg, sizeof(msg)) > 0) {
Expand Down Expand Up @@ -261,7 +261,7 @@ void Manager::wait(Server *_server) {
if (exit_status.get_pid() < 0) {
if (!pool->reloading) {
_error:
if (errno > 0 && errno != EINTR) {
if (errnoAfterWait > 0 && errnoAfterWait != EINTR) {
swoole_sys_warning("wait() failed");
}
continue;
Expand Down

0 comments on commit 307c006

Please sign in to comment.