Reduce redbean logging for EBADF (#461)

This may happen on explicitly closed client connections, so reduce the
logging level similar to other errors.
This commit is contained in:
Paul Kulchenko 2022-07-08 07:14:50 -07:00 committed by GitHub
parent 059fe22ea3
commit 11ac8f11a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2273,7 +2273,11 @@ static ssize_t Send(struct iovec *iov, int iovlen) {
errno = 0;
} else {
LockInc(&shared->c.writeerrors);
WARNF("(rsp) %s write error: %m", DescribeClient());
if (errno == EBADF) { // don't warn on close/bad fd
DEBUGF("(rsp) %s write badf", DescribeClient());
} else {
WARNF("(rsp) %s write error: %m", DescribeClient());
}
}
connectionclose = true;
}
@ -5408,7 +5412,7 @@ static const char *DescribeClose(void) {
if (killed) return "killed";
if (meltdown) return "meltdown";
if (terminated) return "terminated";
if (connectionclose) return "connectionclose";
if (connectionclose) return "connection closed";
return "destroyed";
}
@ -6311,15 +6315,19 @@ static void HandleMessages(void) {
LockInc(&shared->c.readtimeouts);
if (amtread) SendTimeout();
NotifyClose();
LogClose("readtimeout");
LogClose("read timeout");
return;
} else if (errno == ECONNRESET) {
LockInc(&shared->c.readresets);
LogClose("readreset");
LogClose("read reset");
return;
} else {
LockInc(&shared->c.readerrors);
WARNF("(clnt) %s readerror: %m", DescribeClient());
if (errno == EBADF) { // don't warn on close/bad fd
LogClose("read badf");
} else {
WARNF("(clnt) %s read error: %m", DescribeClient());
}
return;
}
if (killed || (terminated && !amtread) ||