Created attachment 216539 [details] minimal repro Apparently, with a sufficiently large payload and the MSG_NOSIGNAL flag, blocking send turns out not quite as blocking as expected. So far this is only observable with 32-bit Linux applications: % /compat/linux/usr/bin/cc -DSERVER -DCLIENT -std=c99 -Wall -m32 eagain-bug.c -pthread -o eagain-bug % ./eagain-bug server started client started connection accepted [server] Sending 100000 bytes... [server] sent: 49032 [server] Sending 100000 bytes... [server] sent: -1 [server] send: Resource temporarily unavailable See attachment for the code. (Or grab it from https://github.com/shkhln/unexpected-eagain.)
By the way, with this program truss outputs something like linux_socketcall(9,{ LINUX_LISTEN, 0x186a0 }) = 49032 (0xbf88) This should rather be linux_socketcall(LINUX_SEND,{ 4, 0x186a0 }) = 49032 (0xbf88)
https://reviews.freebsd.org/D28504
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=f6e8256a965d5b7a7d43034ea31b2430a3b51066 commit f6e8256a965d5b7a7d43034ea31b2430a3b51066 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-02-05 17:24:23 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-02-06 23:21:27 +0000 linux: fix handling of flags for 32 bit send(2) syscall Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. PR: 248065 Reported By: Alex S <iwtcex@gmail.com> Tested By: Alex S <iwtcex@gmail.com> Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation sys/compat/linux/linux_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch stable/13 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=9d930fb09072d21464288df8c834cb8d0b760073 commit 9d930fb09072d21464288df8c834cb8d0b760073 Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-02-05 17:24:23 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-03-02 18:43:27 +0000 linux: fix handling of flags for 32 bit send(2) syscall Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. PR: 248065 Reported By: Alex S <iwtcex@gmail.com> Tested By: Alex S <iwtcex@gmail.com> Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation (cherry picked from commit f6e8256a965d5b7a7d43034ea31b2430a3b51066) sys/compat/linux/linux_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
A commit in branch releng/13.0 references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=fdd7609f10236df34c8d8ae2d6f2dae46e0e96cf commit fdd7609f10236df34c8d8ae2d6f2dae46e0e96cf Author: Edward Tomasz Napierala <trasz@FreeBSD.org> AuthorDate: 2021-02-05 17:24:23 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> CommitDate: 2021-03-04 23:29:22 +0000 linux: fix handling of flags for 32 bit send(2) syscall Previously the flags were passed as-is, which could resulted in spurious EAGAIN returned for non-blocking sockets, which broke some Steam games. Approved by: re (gjb) PR: 248065 Reported By: Alex S <iwtcex@gmail.com> Tested By: Alex S <iwtcex@gmail.com> Reviewed By: emaste MFC After: 3 days Sponsored By: The FreeBSD Foundation (cherry picked from commit f6e8256a965d5b7a7d43034ea31b2430a3b51066) (cherry picked from commit 9d930fb09072d21464288df8c834cb8d0b760073) sys/compat/linux/linux_socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)