[ https://issues.apache.org/jira/browse/KAFKA-9265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16987300#comment-16987300 ]
ASF GitHub Bot commented on KAFKA-9265: --------------------------------------- soondenana commented on pull request #7773: KAFKA-9265: Fix kafka.log.Log instance leak on log deletion URL: https://github.com/apache/kafka/pull/7773 KAFKA-8448 fixes problem with similar leak. The Log objects are being held in ScheduledExecutor PeriodicProducerExpirationCheck callback. The fix in KAFKA-8448 was to change the policy of ScheduledExecutor to remove the scheduled task when it gets canceled (by calling setRemoveOnCancelPolicy(true)). This works when a log is closed using close() method. But when a log is deleted either when the topic gets deleted or when the rebalancing operation moves the replica away from broker, the delete() operation is invoked. Log.delete() doesn't close the pending scheduled task and that leaks Log instance. Fix is to close the scheduled task in the Log.delete() method too. Tested with and without this fix and Log instances are no longer leaked and scheduled tasks are gone once log is deleted. *More detailed description of your change, if necessary. The PR title and PR message become the squashed commit message, so use a separate comment to ping reviewers.* *Summary of testing strategy (including rationale) for the feature or bug fix. Unit and/or integration tests are expected for any behaviour change and system tests should be considered for larger changes.* ### Committer Checklist (excluded from commit message) - [ ] Verify design and implementation - [ ] Verify test coverage and CI build status - [ ] Verify documentation (including upgrade notes) ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > kafka.log.Log instances are leaking on log delete > ------------------------------------------------- > > Key: KAFKA-9265 > URL: https://issues.apache.org/jira/browse/KAFKA-9265 > Project: Kafka > Issue Type: Bug > Reporter: Vikas Singh > Assignee: Vikas Singh > Priority: Major > > KAFKA-8448 fixes problem with similar leak. The {{Log}} objects are being > held in {{ScheduledExecutor}} {{PeriodicProducerExpirationCheck}} callback. > The fix in KAFKA-8448 was to change the policy of {{ScheduledExecutor}} to > remove the scheduled task when it gets canceled (by calling > {{setRemoveOnCancelPolicy(true)}}). > This works when a log is closed using {{close()}} method. But when a log is > deleted either when the topic gets deleted or when the rebalancing operation > moves the replica away from broker, the {{delete()}} operation is invoked. > {{Log.delete()}} doesn't close the pending scheduled task and that leaks Log > instance. > Fix is to close the scheduled task in the {{Log.delete()}} method too. -- This message was sent by Atlassian Jira (v8.3.4#803005)