{"record":{"id":"c9e17379221a02fb","repo":"conductor-oss/conductor","slug":"fail-to-open-conntype-channel","errorCode":null,"errorMessage":"Fail to open <connType> channel","messagePattern":"Fail to open <connType> channel","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPConnection.java","lineNumber":218,"sourceCode":"                        publisherConnection = createConnection(PUBLISHER);\n                    }\n                }\n                return borrowChannel(connectionType, publisherConnection);\n            default:\n                return null;\n        }\n    }\n\n    private Channel getOrCreateChannel(ConnectionType connType, Connection rmqConnection) {\n        // Channel creation is required\n        Channel locChn = null;\n        int retryIndex = 1;\n        while (true) {\n            try {\n                LOGGER.debug(\"Creating a channel for \" + connType);\n                locChn = rmqConnection.createChannel();\n                if (locChn == null || !locChn.isOpen()) {\n                    throw new RuntimeException(\"Fail to open \" + connType + \" channel\");\n                }\n                locChn.addShutdownListener(\n                        cause -> {\n                            LOGGER.error(\n                                    connType + \" Channel has been shutdown: {}\",\n                                    cause.getMessage(),\n                                    cause);\n                        });\n                return locChn;\n            } catch (final IOException e) {\n                AMQPRetryPattern retry = retrySettings;\n                if (retry == null) {\n                    throw new RuntimeException(\n                            \"Cannot open \"\n                                    + connType\n                                    + \" channel on \"\n                                    + Arrays.stream(addresses)\n                                            .map(address -> address.toString())","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/conductor-oss/conductor/blob/cf7c3e4a8adfb158be778ab1ec525323c363cd3a/amqp/src/main/java/com/netflix/conductor/contribs/queue/amqp/AMQPConnection.java#L200-L236","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the maxChannelCount configured in AMQPEventQueueProperties against the broker's channel_max, and confirm channel churn is not exhausting the limit.","Ensure publisher and subscriber channels are returned to the pool via returnChannel so they are reused instead of re-created.","Confirm the connection is healthy and not in automatic-recovery at the moment of channel creation.","Check broker resource alarms (memory/disk) that can close channels."],"exampleFix":"# before: channel limit too low for the workload\nconductor.amqp.maxChannelCount=50\n\n# after: align with broker capacity and reuse channels via the pool\nconductor.amqp.maxChannelCount=2048","handlingStrategy":"try-catch","validationCode":"// Validate channel capacity before heavy use\nint requested = properties.getMaxChannelCount();\nif (requested <= 0) throw new IllegalStateException(\"maxChannelCount must be positive\");\n// keep publisher+subscriber active channels well under broker channel_max","typeGuard":null,"tryCatchPattern":"try {\n    Channel chn = amqpConnection.getOrCreateChannel(ConnectionType.PUBLISHER, queueName);\n    // ... use and returnChannel when done\n} catch (RuntimeException e) {\n    LOGGER.error(\"Failed to open {} channel: {}\", ConnectionType.PUBLISHER, e.getMessage(), e);\n    throw e;\n}","preventionTips":["Always return channels to the pool via returnChannel so they are reused, not re-created.","Keep maxChannelCount below the broker's channel_max with headroom.","Avoid churning channels per message; reuse publisher channels."],"tags":["amqp","rabbitmq","channel"],"backgroundTag":null,"analyzedSha":"cf7c3e4a8adfb158be778ab1ec525323c363cd3a","analyzedAt":"2026-08-14T03:33:19.897Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}