Skip to content

Commit e1b34bc

Browse files
authored
[simulation] increase socket receive buffer size to 2MB (openthread#13173)
This commit sets the SO_RCVBUF socket option to 2MB on the multicast receiving sockets in the simulation platform. Under heavy simulation load (such as expect tests with 15 nodes all sending MLE advertisements and discovery packets), the default OS UDP receive socket buffer can overflow, leading to silent packet drops. This occasionally caused expect tests like cli-big-table.exp to fail with "Join failed [NotFound]" because Node 4's discovery requests or response beacons were dropped. Increasing the receive buffer size to 2MB prevents packet loss during dense simulation runs, resolving intermittent CI test failures.
1 parent fa37423 commit e1b34bc

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

examples/platforms/simulation/simul_utils.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ static void InitRxSocket(utilsSocket *aSocket,
9191
int fd;
9292
int one = 1;
9393
int rval;
94+
int rcvBufSize = 2 * 1024 * 1024;
9495

9596
fd = socket(aIp4Address ? AF_INET : AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
9697
ExpectOrExitWithErrorMsg(fd != -1, "socket(RxFd)");
@@ -101,6 +102,9 @@ static void InitRxSocket(utilsSocket *aSocket,
101102
rval = setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &one, sizeof(one));
102103
ExpectOrExitWithErrorMsg(rval != -1, "setsockopt(RxFd, SO_REUSEPORT)");
103104

105+
rval = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &rcvBufSize, sizeof(rcvBufSize));
106+
ExpectOrExitWithErrorMsg(rval != -1, "setsockopt(RxFd, SO_RCVBUF)");
107+
104108
if (aIp4Address)
105109
{
106110
struct ip_mreqn mreq;

0 commit comments

Comments
 (0)