Michał Ciesielczyk created FLINK-23182:
------------------------------------------
Summary: Connection leak in RMQSource
Key: FLINK-23182
URL: https://issues.apache.org/jira/browse/FLINK-23182
Project: Flink
Issue Type: Sub-task
Components: Connectors/ RabbitMQ
Affects Versions: 1.12.4, 1.13.1, 1.14.0
Reporter: Michał Ciesielczyk
The RabbitMQ connection is not closed properly in the RMQSource connector in
case of failures. This leads to a connection leak (we loose handles to still
opened connections) that will last until the Flink TaskManager is either
stopped or crashes.
The issue is caused by improper resource releasing in open and close methods of
RMQSource:
-
[https://github.com/apache/flink/blob/master/flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSource.java#L260]
- here the connection is opened, but not closed in case of failure (e.g.
caused by invalid queue configuration)
-
[https://github.com/apache/flink/blob/master/flink-connectors/flink-connector-rabbitmq/src/main/java/org/apache/flink/streaming/connectors/rabbitmq/RMQSource.java#L282]
- here the connection might not closed properly if stopping the consumer
causes a failure first
In both cases, the solution is relatively simple - make sure that the
connection#close is always called if it should be (failing to close one
resource should not prevent other close methods from being called). In open we
probably can silently close allocated resources (as the process did not succeed
eventually anyway). In close, we should either throw the first caught exception
or the last one, and log all the others as warnings.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)