ferenc-csaky commented on PR #134:
URL:
https://github.com/apache/flink-connector-pulsar/pull/134#issuecomment-7192222046
Thanks for this. `MetadataListenerTest` in the same package has the same
leak: all five tests call `listener.open(...)`, which creates a `PulsarClient`
(`MetadataListener.java:102`), and none of them close the listener. Could you
wrap those in try-with-resources too, so the PR covers all the sink writer
tests?
A smaller gap in `PulsarWriterTest`: the `PulsarWriter` constructor opens
the listener first (`PulsarWriter.java:127`) and creates the `ProducerRegister`
after that. If the constructor throws in between, try-with-resources never gets
a writer to close, so the listener's client stays open. One way to handle it is
to put the listener in its own
resource, `try (MetadataListener l = listener; PulsarWriter<String> writer
= ...)`. A second `close()` on the listener after the writer closes it just
calls `PulsarClient.close()` again, which should be a no-op on an
already-closed client.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]