sendfile() does two things under the hoodl

read from input fd and write to output fd
The documentation says explicitly that if the problem was in reading from input fd then errno = 5.
But Nginx logs a generic i/o error.
This commit is contained in:
Gabriel Clima 2025-08-13 21:07:56 +00:00
parent 1a82df8cca
commit c93981e2e9
1 changed files with 10 additions and 0 deletions

View File

@ -274,6 +274,11 @@ eintr:
"sendfile() was interrupted");
goto eintr;
case EIO: /*Unspecified error while reading from in_fd.*/
ngx_log_error(NGX_LOG_ERR, c->log, EIO,
"sendfile() reading %s", file->file->name.data);
return NGX_ERROR;
default:
c->write->error = 1;
ngx_connection_error(c, err, "sendfile() failed");
@ -358,6 +363,11 @@ ngx_linux_sendfile_thread(ngx_connection_t *c, ngx_buf_t *file, size_t size)
return NGX_AGAIN;
}
if (ctx->err == EIO) { /*Unspecified error while reading from in_fd.*/
ngx_log_error(NGX_LOG_ERR, c->log, EIO,
"sendfile() reading %s", file->file->name.data);
return NGX_ERROR;
if (ctx->err) {
wev->error = 1;
ngx_connection_error(c, ctx->err, "sendfile() failed");