Netflix/zuul · error · OriginConnectException

maxConnectionsPerHost=

Error message

maxConnectionsPerHost={}, connectionsPerHost={}

What it means

isWithinConnectionLimit is the guard enforcing the per-origin MaxConnectionsPerHost setting in PerServerConnectionPool. It fires when the number of open-plus-opening connections to a host has reached the configured cap, logging 'maxConnectionsPerHost={}, connectionsPerHost={}' and returning false so tryMakingNewConnection will not open another connection. It is a capacity back-pressure condition, not an exception.

Solutions

  1. Increase maxConnectionsPerHost in the origin's connection pool config if the limit is set too low for real traffic
  2. Check for origin slowness or connection leaks that keep connections open longer than necessary
  3. Scale out origin instances so connections are spread across more hosts
  4. Add client-side throttling/circuit breaking so requests queue instead of exhausting the pool
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/PerServerConnectionPool.java:285 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Netflix/zuul@14bf53c52d (2026-09-07). Data as JSON: /api/errors/c42388a221781fb0. Report an issue: GitHub.

Appendix: source

Thrown at zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/PerServerConnectionPool.java:285

                        LOG.warn(
                                "Error creating new connection! origin={}, host={}",
                                config.getOriginName(),
                                server.getServerId());
                    }
                });
            }
        } catch (Throwable e) {
            promise.setFailure(e);
        }
    }

    protected boolean isWithinConnectionLimit(Promise<PooledConnection> promise) {
        // Enforce MaxConnectionsPerHost config.
        int maxConnectionsPerHost = config.maxConnectionsPerHost();
        int openAndOpeningConnectionCount = server.getOpenConnectionsCount() + connCreationsInProgress.get();
        if (maxConnectionsPerHost != -1 && openAndOpeningConnectionCount >= maxConnectionsPerHost) {
            maxConnsPerHostExceededCounter.increment();
            promise.setFailure(new OriginConnectException(
                    "maxConnectionsPerHost=" + maxConnectionsPerHost + ", connectionsPerHost="
                            + openAndOpeningConnectionCount,
                    OutboundErrorType.ORIGIN_SERVER_MAX_CONNS));
            LOG.warn(
                    "Unable to create new connection because at MaxConnectionsPerHost! maxConnectionsPerHost={},"
                            + " connectionsPerHost={}, host={}origin={}",
                    maxConnectionsPerHost,
                    openAndOpeningConnectionCount,
                    server.getServerId(),
                    config.getOriginName());
            return false;
        }
        return true;
    }

    protected ChannelFuture connectToServer(EventLoop eventLoop, CurrentPassport passport, SocketAddress serverAddr) {
        return connectionFactory.connect(eventLoop, serverAddr, passport, this);
    }

View on GitHub (pinned to 14bf53c52d)