gharris1727 opened a new pull request, #14764:
URL: https://github.com/apache/kafka/pull/14764

   These tests contain typos that leak sockets, mostly through clients that are 
left open.
   
   The WorkerTest had rather involved resource leaks, which arose because the 
typical lifetime of the WorkerTask was partially or totally mocked. The 
WorkerTask subclass constructors accept clients as arguments, and take 
ownership of those clients, and the partial mocking prevented those clients 
from being closed appropriately.
   
   Now, all of (WorkerSourceTask, ExactlyOnceWorkerSourceTask, WorkerSinkTask) 
have their constructors mocked, and those constructors close the passed-in 
resources immediately. This also allows the test to avoid waiting for some 
cancellation timeouts to expire, making the test faster to run.
   
   The other systematic typo that was present was the OffsetStore not being 
configured or closed, which caused a consumer to be leaked. This is because the 
constructor is instantiated in the factory method (e.g. 
offsetStoreForExactlyOnceSourceTask), but the KafkaOffsetBackingStore.offsetLog 
field field is only initialized inside of configure(WorkerConfig). Rather than 
making OffsetBackingStore implementations close the consumer even when 
configure is not called, I made the test use a more realistic lifecycle and 
actually call configure(WorkerConfig) and stop().
   
   ### 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.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to