{"record":{"id":"285dda78ab0d6671","repo":"aeron-io/aeron","slug":"mtulength-mtulength-so-sndbuf-sosndbuf-increase-socket","errorCode":null,"errorMessage":"mtuLength=${mtuLength} > SO_SNDBUF=${soSndBuf}, increase ${SOCKET_SNDBUF_LENGTH_PROP_NAME} to match MTU","messagePattern":"mtuLength=(.+?) > SO_SNDBUF=(.+?), increase (.+?) to match MTU","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/Configuration.java","lineNumber":2521,"sourceCode":"        {\n            System.err.println(\n                \"WARNING: Could not set desired SO_SNDBUF, adjust OS to allow \" + SOCKET_SNDBUF_LENGTH_PROP_NAME +\n                \" attempted=\" + ctx.socketSndbufLength() + \", actual=\" + ctx.osMaxSocketSndbufLength());\n        }\n\n        if (ctx.osMaxSocketRcvbufLength() < ctx.socketRcvbufLength())\n        {\n            System.err.println(\n                \"WARNING: Could not set desired SO_RCVBUF, adjust OS to allow \" + SOCKET_RCVBUF_LENGTH_PROP_NAME +\n                \" attempted=\" + ctx.socketRcvbufLength() + \", actual=\" + ctx.osMaxSocketRcvbufLength());\n        }\n\n        final int soSndBuf = 0 == ctx.socketSndbufLength() ?\n            ctx.osDefaultSocketSndbufLength() : ctx.socketSndbufLength();\n\n        if (ctx.mtuLength() > soSndBuf)\n        {\n            throw new ConfigurationException(\n                \"mtuLength=\" + ctx.mtuLength() + \" > SO_SNDBUF=\" + soSndBuf +\n                \", increase \" + SOCKET_SNDBUF_LENGTH_PROP_NAME + \" to match MTU\");\n        }\n\n        final int soRcvBuf = 0 == ctx.socketRcvbufLength() ?\n            ctx.osDefaultSocketRcvbufLength() : ctx.socketRcvbufLength();\n\n        if (ctx.initialWindowLength() > soRcvBuf)\n        {\n            throw new ConfigurationException(\n                \"initialWindowLength=\" + ctx.initialWindowLength() + \" > SO_RCVBUF=\" + soRcvBuf +\n                \", increase \" + SOCKET_RCVBUF_LENGTH_PROP_NAME + \" limits to match initialWindowLength\");\n        }\n    }\n\n    /**\n     * Validate that page size is valid and alignment is valid.\n     *","sourceCodeStart":2503,"sourceCodeEnd":2539,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/Configuration.java#L2503-L2539","documentation":"During driver conclusion, Aeron validates that the configured MTU length is not larger than the OS socket send buffer (SO_SNDBUF), because a datagram larger than the send buffer cannot be sent. If ctx.mtuLength() exceeds the effective SO_SNDBUF (explicitly configured or OS default), Configuration throws this ConfigurationException and the driver fails to start.","triggerScenarios":"Running Configuration.validateSocketBufferLengths(ctx) when ctx.mtuLength() > soSndBuf, i.e. aeron.socket.sndbuf.length (or the OS default when 0) is smaller than aeron.mtu.length.","commonSituations":"Raising MTU (e.g. to 16384) while the OS socket send buffer stays at the default (~212992 bytes is fine, but container/limited environments or explicitly low Aeron SO_SNDBUF settings are not); tuning down SO_SNDBUF for memory savings while keeping a large MTU.","solutions":["Increase aeron.socket.sndbuf.length (SOCKET_SNDBUF_LENGTH_PROP_NAME) to be >= mtuLength","Or lower aeron.mtu.length so it fits within the current SO_SNDBUF","If relying on OS defaults, raise the OS-level net.core.wmem_default / wmem_max so the default SO_SNDBUF exceeds the MTU"],"exampleFix":"// before\nctx.mtuLength(16384);\nctx.socketSndbufLength(8192);\n// after\nctx.mtuLength(16384);\nctx.socketSndbufLength(65536); // >= mtuLength","handlingStrategy":"validation","validationCode":"int soSndBuf = socketSndbufLength != 0 ? socketSndbufLength : osDefaultSocketSndbufLength;\nif (mtuLength > soSndBuf) {\n    throw new IllegalStateException(\"raise aeron.socket.sndbuf.length to >= \" + mtuLength);\n}","typeGuard":null,"tryCatchPattern":"try {\n    mediaCtx.conclude();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"SO_SNDBUF\")) {\n        mediaCtx.socketSndbufLength(mediaCtx.mtuLength());\n        mediaCtx.conclude();\n    } else { throw e; }\n}","preventionTips":["Set SO_SNDBUF and MTU together as a pair in your config tooling","Check OS limits (net.core.wmem_max) before deploying large-MTU configs","Validate driver context in CI before shipping configuration"],"tags":["aeron","configuration","socket-buffer","mtu"],"backgroundTag":"conflicting-config-options","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}