apache/druid · info

Unable to read /proc/sys/net/core/somaxconn, falling back…

Error message

Unable to read /proc/sys/net/core/somaxconn, falling back to default value for TCP accept queue size

What it means

JettyServerModule tries to tune Jetty's TCP accept queue size from the OS setting /proc/sys/net/core/somaxconn. If that file cannot be read or parsed, it logs this warning and falls back to the default value of 128.

Solutions

  1. Verify the file exists and is readable: cat /proc/sys/net/core/somaxconn.
  2. If the warning is acceptable, do nothing — behavior falls back to acceptQueueSize 128.
  3. For a larger backlog, raise the OS limit (sysctl -w net.core.somaxconn=4096) so Jetty picks it up.
  4. Alternatively set druid.server.http.numAcceptors/queue sizing explicitly in runtime properties if tuning is needed.

Example fix

// before: container without /proc read access -> warning at startup
// after: grant read access or preset the sysctl in the image
sysctl -w net.core.somaxconn=1024
Defensive patterns

Strategy: fallback

Validate before calling

long somaxconn = -1;
try (BufferedReader in = new BufferedReader(new FileReader("/proc/sys/net/core/somaxconn"))) {
  somaxconn = Long.parseLong(in.readLine().trim());
} catch (Exception e) {
  // non-Linux or restricted /proc; default 128 will be used
}

Prevention

When it happens

Trigger: makeAndInitializeServer calls getTCPAcceptQueueSize; BufferedReader readLine() or Integer.parseInt() on the file's content throws (file missing, permission denied, unexpected content, non-Linux OS without /proc).

Common situations: Running Druid in containers/OSes where /proc/sys/net/core/somaxconn is absent or restricted; read-only /proc mounts; hardened security profiles (SELinux/AppArmor) blocking the read.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/d2bfb11ebb30dcf1. Report an issue: GitHub.

Appendix: source

Thrown at server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java:508

  private static int getMaxJettyAcceptorsSelectorsNum(DruidNode druidNode)
  {
    // This computation is based on Jetty v9.3.19 which uses upto 8(4 acceptors and 4 selectors) threads per
    // ServerConnector
    int numServerConnector = (druidNode.isEnablePlaintextPort() ? 1 : 0) + (druidNode.isEnableTlsPort() ? 1 : 0);
    return numServerConnector * 8;
  }

  private static int getTCPAcceptQueueSize()
  {
    if (SystemUtils.IS_OS_LINUX) {
      try (BufferedReader in = Files.newBufferedReader(Paths.get("/proc/sys/net/core/somaxconn"))) {
        String acceptQueueSize = in.readLine();
        if (acceptQueueSize != null) {
          return Integer.parseInt(acceptQueueSize);
        }
      }
      catch (Exception e) {
        log.warn("Unable to read /proc/sys/net/core/somaxconn, falling back to default value for TCP accept queue size");
      }
    }
    return 128; // Default value of net.core.somaxconn
  }

  @Provides
  @LazySingleton
  public JettyMonitor getJettyMonitor()
  {
    return new JettyMonitor();
  }

  public static class JettyMonitor extends AbstractMonitor
  {
    @Override
    public boolean doMonitor(ServiceEmitter emitter)
    {
      final ServiceMetricEvent.Builder builder = new ServiceMetricEvent.Builder();

View on GitHub (pinned to 9b90983fd2)