The GitHub Actions job "CI" on pekko-connectors-kafka.git/resource-leak-producer-consumer has failed. Run started by GitHub user pjfanning (triggered by pjfanning).
Head commit for run: a5da9821267b649344d2de2c48c0224de8422404 / PJ Fanning <[email protected]> fix Kafka client leaks in producer stages and consumer actor Motivation: Two paths leak Kafka clients. `DeferredProducer.resolveProducer` assigns the asynchronously created producer through `AsyncCallback.invoke`, which is silently dropped once the stage has completed. When the stage fails or is cancelled while the producer is still being created, the producer is never assigned, so `closeProducer` (gated on the `Assigned` lifecycle) does nothing and the `KafkaProducer` is orphaned. This is not a narrow race: without async enrichment `createKafkaProducerAsync` still maps on the materializer execution context, so producer creation is normally asynchronous. `KafkaConsumerActor.postStop` calls the user supplied partition assignment handler before closing the consumer. A handler that throws in `onStop` skips `consumer.close`, leaking the consumer and its group membership. The same line also throws a `NullPointerException` when the actor is stopped before the settings were applied, because `consumer` and `settings` are still null, which hides the original stop reason. Modification: Use `invokeWithFeedback` for the producer assignment and close the producer when the callback is rejected because the stage is gone. Wrap the partition assignment handler call in try/finally, log a handler failure, and only close the consumer when it was created. Result: Producers created after their stage completed are closed, and the consumer is closed even when the partition assignment handler fails or the actor stops before it has a consumer. Tests: - sbt "tests/Test/testOnly org.apache.pekko.kafka.internal.*" - 137 succeeded, 0 failed (the three new tests fail without the fixes) - sbt core/mimaReportBinaryIssues - success - sbt scalafmtCheckAll headerCheckAll - success References: None - resource leak audit of the main sources Report URL: https://github.com/apache/pekko-connectors-kafka/actions/runs/34059930999 With regards, GitHub Actions via GitBox --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
