{"record":{"id":"ad835c1d48aa5f81","repo":"aeron-io/aeron","slug":"probe-socket-ex","errorCode":null,"errorMessage":"probe socket: {ex}","messagePattern":"probe socket: (.+?)","errorType":"exception","errorClass":"AeronException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java","lineNumber":4320,"sourceCode":"            {\n                return;\n            }\n\n            try (DatagramChannel probe = DatagramChannel.open())\n            {\n                osDefaultSocketSndbufLength = probe.getOption(StandardSocketOptions.SO_SNDBUF);\n\n                probe.setOption(StandardSocketOptions.SO_SNDBUF, Integer.MAX_VALUE);\n                osMaxSocketSndbufLength = probe.getOption(StandardSocketOptions.SO_SNDBUF);\n\n                osDefaultSocketRcvbufLength = probe.getOption(StandardSocketOptions.SO_RCVBUF);\n\n                probe.setOption(StandardSocketOptions.SO_RCVBUF, Integer.MAX_VALUE);\n                osMaxSocketRcvbufLength = probe.getOption(StandardSocketOptions.SO_RCVBUF);\n            }\n            catch (final IOException ex)\n            {\n                throw new AeronException(\"probe socket: \" + ex, ex);\n            }\n        }\n\n        @SuppressWarnings({ \"MethodLength\", \"deprecation\" })\n        void concludeNullProperties()\n        {\n            if (null == tempBuffer)\n            {\n                tempBuffer = new UnsafeBuffer(new byte[METADATA_LENGTH]);\n            }\n\n            if (null == epochClock)\n            {\n                epochClock = SystemEpochClock.INSTANCE;\n            }\n\n            if (null == nanoClock)\n            {","sourceCodeStart":4302,"sourceCodeEnd":4338,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java#L4302-L4338","documentation":"Thrown during MediaDriver.Context initialization while probing the OS socket limits: the driver opens a probe socket, tries to set SO_RCVBUF to Integer.MAX_VALUE and read back the OS maximum; if any IOException occurs during this probing it wraps it in AeronException. It indicates the process cannot create/configure sockets at all (e.g. resource exhaustion or restricted environment).","triggerScenarios":"Context.concludeBytesOsDefaults probing when socket creation fails due to file-descriptor exhaustion, no network permission (restricted container/seccomp), or the OS rejecting socket option operations with an IOException.","commonSituations":"Running in a sandboxed container without CAP_NET_RAW/network syscalls allowed; ulimit -n (fd limit) already hit; IPv4/IPv6 stack disabled so the probe socket cannot be opened; overly strict security profiles blocking setsockopt.","solutions":["Check and raise the file descriptor limit (ulimit -n) and verify the process is not leaking sockets.","Verify the runtime allows socket creation (container seccomp/AppArmor profiles, security options) and that a network stack exists.","Test with a trivial Java socket program in the same environment to isolate the cause.","Catch AeronException at driver launch and log the cause; run the driver in an unrestricted host/network namespace."],"exampleFix":"// before\nMediaDriver.launch(); // fails in restricted container\n// after\n// in Docker: run with adequate network privileges\ndocker run --network=host --ulimit nofile=65536:65536 mydriver-image\n// then\nMediaDriver.launch();","handlingStrategy":"try-catch","validationCode":"try (DatagramSocket probe = new DatagramSocket()) {\n    probe.setOption(StandardSocketOptions.SO_RCVBUF, Integer.MAX_VALUE); // fails here in restricted envs\n}","typeGuard":null,"tryCatchPattern":"try {\n    mediaDriver = MediaDriver.launch();\n} catch (AeronException e) {\n    if (e.getMessage().startsWith(\"probe socket:\")) {\n        throw new IllegalStateException(\"environment cannot create/configure sockets; check fd limits and container security profile\", e);\n    } else { throw e; }\n}","preventionTips":["Verify socket creation works in the target container/host before deploying","Raise ulimit -n for the driver process","Keep container seccomp profiles permissive for network syscalls","Monitor fd usage to prevent exhaustion"],"tags":["aeron","driver","sockets","environment"],"backgroundTag":"connection-refused","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"}