conductor-oss/conductor · error · RuntimeException

Fail to open <connType> channel

Error message

Fail to open <connType> channel

What it means

getOrCreateChannel(ConnectionType, Connection) calls rmqConnection.createChannel() and, if the returned Channel is null or its isOpen() is false, throws this RuntimeException. createChannel returns null only in pathological cases; !isOpen() means the channel was closed immediately after creation (for example the broker refused it because the channel limit was reached, or the parent connection is in a bad state).

Source

Thrown at amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPConnection.java:218

                        publisherConnection = createConnection(PUBLISHER);
                    }
                }
                return borrowChannel(connectionType, publisherConnection);
            default:
                return null;
        }
    }

    private Channel getOrCreateChannel(ConnectionType connType, Connection rmqConnection) {
        // Channel creation is required
        Channel locChn = null;
        int retryIndex = 1;
        while (true) {
            try {
                LOGGER.debug("Creating a channel for " + connType);
                locChn = rmqConnection.createChannel();
                if (locChn == null || !locChn.isOpen()) {
                    throw new RuntimeException("Fail to open " + connType + " channel");
                }
                locChn.addShutdownListener(
                        cause -> {
                            LOGGER.error(
                                    connType + " Channel has been shutdown: {}",
                                    cause.getMessage(),
                                    cause);
                        });
                return locChn;
            } catch (final IOException e) {
                AMQPRetryPattern retry = retrySettings;
                if (retry == null) {
                    throw new RuntimeException(
                            "Cannot open "
                                    + connType
                                    + " channel on "
                                    + Arrays.stream(addresses)
                                            .map(address -> address.toString())

View on GitHub (pinned to cf7c3e4a8a)

Solutions

  1. Check the maxChannelCount configured in AMQPEventQueueProperties against the broker's channel_max, and confirm channel churn is not exhausting the limit.
  2. Ensure publisher and subscriber channels are returned to the pool via returnChannel so they are reused instead of re-created.
  3. Confirm the connection is healthy and not in automatic-recovery at the moment of channel creation.
  4. Check broker resource alarms (memory/disk) that can close channels.

Example fix

# before: channel limit too low for the workload
conductor.amqp.maxChannelCount=50

# after: align with broker capacity and reuse channels via the pool
conductor.amqp.maxChannelCount=2048
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate channel capacity before heavy use
int requested = properties.getMaxChannelCount();
if (requested <= 0) throw new IllegalStateException("maxChannelCount must be positive");
// keep publisher+subscriber active channels well under broker channel_max

Try / catch

try {
    Channel chn = amqpConnection.getOrCreateChannel(ConnectionType.PUBLISHER, queueName);
    // ... use and returnChannel when done
} catch (RuntimeException e) {
    LOGGER.error("Failed to open {} channel: {}", ConnectionType.PUBLISHER, e.getMessage(), e);
    throw e;
}

Prevention

When it happens

Trigger: borrowChannel calls getOrCreateChannel on a fresh or pooled-out publisher/subscriber connection; createChannel returns a channel that is already closed, so the guard fires before the shutdown listener is attached.

Common situations: max_channels per connection exceeded (broker channel_max or the factory's requestedChannelMax); the connection is mid-automatic-recovery and momentarily unusable; a broker resource alarm closing new channels.

Related errors


AI-assisted analysis of conductor-oss/conductor@cf7c3e4a8a (2026-08-14). Data as JSON: /api/errors/c9e17379221a02fb. Report an issue: GitHub.