P1sec / pysctp

SCTP stack for Python
http://www.p1sec.com
161 stars 67 forks source link

Weird race condition between accept() and sctp_recvmsg() #17

Closed zapstar closed 1 year ago

zapstar commented 8 years ago

On the python process I'm seeing an EINVAL returned by sctp_recvmsg() just after accept(). Here's the strace output for the same

epoll_wait(22, {{EPOLLIN, {u32=3, u64=41313874535776259}}}, 1023, 5000) = 1
accept(3, {sa_family=AF_INET, sin_port=htons(48385), sin_addr=inet_addr("127.0.0.1")}, [16]) = 23
getsockopt(23, 0x84 /* SOL_??? */, 2, "\3\0\3\0\10\0\10\0", [8]) = 0
getsockopt(23, 0x84 /* SOL_??? */, 11, "\1\0\0\0\0\0\0\0\0\0", [10]) = 0
recvmsg(23, 0x7ffeef79aad0, MSG_OOB|MSG_PEEK|MSG_DONTROUTE|MSG_CTRUNC|MSG_TRUNC|MSG_DONTWAIT|MSG_EOR|MSG_WAITALL|MSG_FIN|MSG_SYN|MSG_CONFIRM|MSG_RST|MSG_ERRQUEUE|MSG_NOSIGNAL|MSG_MORE|MSG_WAITFORONE|MSG_FASTOPEN|MSG_CMSG_CLOEXEC|0x9ffe0010) = -1 EINVAL (Invalid argument)

For now the workaround is to try again some more times if you receive an EINVAL.