Skip to content

Commit

Permalink
Fix deadlock + 100% CPU caused by wrong loop exit condition.
Browse files Browse the repository at this point in the history
Suspected cause for GH-1709, GH-1732. Inspection revealed another wrong
exit condition (causing preliminary exit in edge-case code), which was
also fixed.
  • Loading branch information
Daniel Knoppel (Phusion) committed Jan 26, 2016
1 parent 9ca81d4 commit 2146b05
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Release 5.0.24
* Also log HTTP headers to Union Station for HTTP 4xx responses (extends the header logging for HTTP 5xx that was added in 5.0.22)
* Fixes cases where compilation failure of (optional) native utils was not reported.
* On Ruby, no longer traps SIGEXIT. This fixes errorneously setting `$ERROR_INFO` in `at_exit` callbacks. Closes GH-1730.
* Fixes a wrong loop exit condition that could cause a deadlock with 100% CPU usage by Passenger core. Closes GH-1709, GH-1732.
* [Standalone] Fixes the default value of the `load_shell_envvars` option. It's supposed to be disabled by default, but due to a typo it was enabled by default.


Expand Down
2 changes: 1 addition & 1 deletion src/cxx_supportlib/ServerKit/FdSinkChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FdSinkChannel: protected Channel {

do {
ret = ::write(watcher.fd, buffer.start, buffer.size());
} while (ret == -1 && errno == EAGAIN);
} while (ret == -1 && errno == EINTR);
if (ret == (ssize_t) buffer.size()) {
return Result(ret, false);
} else if (ret >= 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/cxx_supportlib/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ getHighestFileDescriptor(bool asyncSignalSafe) {

do {
ret = read(p[0], u.data + bytesRead, sizeof(int) - bytesRead);
} while (ret == -1 && ret == EINTR);
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
if (errno != EAGAIN) {
goto done;
Expand Down

0 comments on commit 2146b05

Please sign in to comment.