Skip to content

Commit

Permalink
Ignore EINTR on close(...) as there is nothing sane we can do.
Browse files Browse the repository at this point in the history
Motivation:

If close(...) reports EINTR there is nothing sane we can do so it makes no sense to even report it. See also:

apple/swift-nio#217

Modifications:

Just ignore EINTR when calling close(...)

Result:

Less noise in the logs.
  • Loading branch information
normanmaurer committed Mar 23, 2018
1 parent 40af10b commit 8189399
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ static jint _read(JNIEnv* env, jclass clazz, jint fd, void* buffer, jint pos, ji
// JNI Registered Methods Begin
static jint netty_unix_filedescriptor_close(JNIEnv* env, jclass clazz, jint fd) {
if (close(fd) < 0) {
return -errno;
// There is really nothing "sane" we can do when EINTR was reported on close. So just ignore it and "assume"
// everything is fine == we closed the file descriptor.
//
// For more details see:
// - https://bugs.chromium.org/p/chromium/issues/detail?id=269623
// - https://lwn.net/Articles/576478/
if (errno != EINTR) {
return -errno;
}
}
return 0;
}
Expand Down

0 comments on commit 8189399

Please sign in to comment.