Getting "Sendmsg error! Strerror=Resource temporarily unavailable" with MTU=65536
We have a test TC_paging_450req_no_paging_load_ind that sends 450 BSSAP messages (BSSMAP paging) via SCCP -> M3UA -> SCTP.
- When we run the test on a typical network interface with MTU=1500, it works as expected.
- When we run it on the "lo" loopback network interface, which has a MTU=65536 by default in Linux, it fails.
We see the following warning in the log:
M3UA_Emulation.ttcn:616 Warning: Sendmsg error! Strerror=Resource temporarily unavailable
This comes from SCTPasp_PT.cc.
This is the string for EAGAIN
and it means according to the sendmsg man page:
The socket's file descriptor is marked O_NONBLOCK and the requested operation would block.
Regarding why it is non-blocking, Gábor wrote in #2 (comment 318213):
The SCTP test port is not designed to be non-blocking. The socket is set to non blocking only to avoid the complete blocking of the execution. The IPL4 test port provides API for handling of the situation.
Looking at the net/sctp/socket.c in linux, apparently this comes from not having enough space in the sndbuf. So I've tried to increase the sndbuf:
diff --git a/src/SCTPasp_PT.cc b/src/SCTPasp_PT.cc
index 2bbffbd..4d57ec1 100644
--- a/src/SCTPasp_PT.cc
+++ b/src/SCTPasp_PT.cc
@@ -1656,6 +1656,22 @@ int SCTPasp__PT_PROVIDER::create_socket(int addr_family)
TTCN_warning("Setsockopt error!");
errno = 0;
}
+
+ log("Setting SCTP socket options (sndbuf).");
+ int sndbuf = 600000;
+ if (setsockopt(local_fd, SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)) < 0)
+ {
+ TTCN_warning("Setsockopt error!");
+ errno = 0;
+ }
With that I'm able to send more BSSAP messages in the test (370 instead of 185), but then it still fails with the same error. Increasing the buffer further has no effect, it still fails at 370.
I have also tried setsockopt with SCTP_NODELAY = 1, but it makes no difference.
More information:
-
Downstream bugreport: has full logs + pcaps in the
logs_ok.tar.gz
/logs_nok.tar.gz
attachments - I've reproduced this bug with current master of titan.TestPorts.SCTPasp.git