NPE in `AbstractMetricsCollector` when channel limit is exceeded
Dav1dde opened this issue · 0 comments
Dav1dde commented
ChannelManager#createChannel can return null when it runs out of free channels, the JavaDoc of AMQConnection#createChannel also says it may return null.
The following code in createChannel() and createChannel(int channelNumber)
leads to an NPE in AbstractMetricsCollector#newChannel:
channel.addShutdownListener will fail with the NPE.
We've observed this through logs in one of our production services:
01-25 12:52:30 INFO c.r.c.impl.AbstractMetricsCollector - Error while computing metrics in newChannel: Cannot invoke "com.rabbitmq.client.Channel.addShutdownListener(com.rabbitmq.client.ShutdownListener)" because "channel" is null