Bug/Performance: sendfile() loop treats EAGAIN / EINTR as fatal errors #168
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
file_send_sendfile()insrc/shared/file.c:456-463callssendfile()in a loop. Ifsendfile()returns-1witherrno == EAGAINorEINTR, the function treats it as a fatal error and returns false. On a non-blocking or busy socket, this can cause unnecessary transfer failures. The function also does not useerrnocorrectly to distinguish recoverable errors from true failures.Location
src/shared/file.c:458-463—sendfile()loop.Suggested fix
errnoaftersendfile()returns-1.EAGAIN(afterpoll()/select() for write readiness) andEINTR.sendfile()only for regular files; fall back toread()/write()for non-regular files.Severity
Low
Category
bug, performance
This issue was automatically generated by the issue-creator agent.