{"record":{"id":"fbf2ff144d06569e","repo":"aeron-io/aeron","slug":"invalid-paramname-length-size","errorCode":null,"errorMessage":"Invalid ${paramName} length: ${size}","messagePattern":"Invalid (.+?) length: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java","lineNumber":364,"sourceCode":"     * Parse a buffer length for a given URI paramName with a format specified by\n     * {@link SystemUtil#parseSize(String, String)}, clamping the range to 0 &lt;= x &lt;= Integer.MAX_VALUE.\n     *\n     * @param channelUri to get the value from.\n     * @param paramName  key for the parameter.\n     * @return value as an integer.\n     * @see SystemUtil#parseSize(String, String)\n     */\n    public static int parseBufferLength(final ChannelUri channelUri, final String paramName)\n    {\n        int socketBufferLength = 0;\n\n        final String paramValue = channelUri.get(paramName);\n        if (null != paramValue)\n        {\n            final long size = SystemUtil.parseSize(paramName, paramValue);\n            if (size < 0 || size > Integer.MAX_VALUE)\n            {\n                throw new IllegalArgumentException(\"Invalid \" + paramName + \" length: \" + size);\n            }\n            socketBufferLength = (int)size;\n        }\n\n        return socketBufferLength;\n    }\n\n    /**\n     * Parse the control mode from the channel URI. If the value is null or unknown then {@link ControlMode#NONE} will\n     * be used.\n     *\n     * @param channelUri to parse the control mode from.\n     * @return an enum value representing the control mode.\n     */\n    public static ControlMode parseControlMode(final ChannelUri channelUri)\n    {\n        final String paramValue = channelUri.get(MDC_CONTROL_MODE_PARAM_NAME);\n        if (null == paramValue)","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/media/UdpChannel.java#L346-L382","documentation":"Thrown when a socket-buffer or receiver-window parameter (socket-rcvbuf-length, socket-sndbuf-length, receiver-window-length) parses to a value below 0 or above Integer.MAX_VALUE. Aeron clamps accepted buffer sizes to the positive int range.","triggerScenarios":"Setting e.g. socket-rcvbuf-length=4g (4294967296, > Integer.MAX_VALUE) or a negative size in the channel URI.","commonSituations":"OS tuning values copied from guides that exceed the 2GB int limit, unit confusion (g vs m suffix from SystemUtil.parseSize).","solutions":["Use a size between 0 and 2147483647, e.g. socket-rcvbuf-length=2m","Lower the requested buffer size; OS SO_RCVBUF limits are usually far below 2GB anyway","Tune the OS-level net.core.rmem_max/wmem_max instead of inflating the URI value beyond int range"],"exampleFix":"// before\n\"aeron:udp?endpoint=...|socket-rcvbuf-length=4g\"\n// after\n\"aeron:udp?endpoint=...|socket-rcvbuf-length=2m\"","handlingStrategy":"validation","validationCode":"long size = SystemUtil.parseSize(\"socket-rcvbuf-length\", value);\nif (size < 0 || size > Integer.MAX_VALUE) throw new IllegalArgumentException(\"size out of range: \" + size);","typeGuard":"static boolean isValidBufferLength(String v) { try { long s = SystemUtil.parseSize(\"p\", v); return s >= 0 && s <= Integer.MAX_VALUE; } catch (Exception e) { return false; } }","tryCatchPattern":"try { pub = aeron.addPublication(uri, stream); } catch (IllegalArgumentException e) { log.error(\"buffer length invalid: {}\", e.getMessage()); }","preventionTips":["Cap buffer sizes at 2^31-1 and rely on OS-level tuning for larger windows","Be careful with g/m/k suffixes from SystemUtil.parseSize","Check net.core.rmem_max before requesting large receive buffers"],"tags":["aeron","channel-uri","buffer-size"],"backgroundTag":"value-out-of-range","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}