Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LeaseRenewer threads still running after shutdown #83

Closed
rankinc opened this issue Jun 28, 2016 · 2 comments
Closed

LeaseRenewer threads still running after shutdown #83

rankinc opened this issue Jun 28, 2016 · 2 comments

Comments

@rankinc
Copy link
Contributor

rankinc commented Jun 28, 2016

I am seeing errors like these in my logs when trying to shut my KCL application down:

2016-06-28 15:19:06,820 [main] [WebappClassLoaderBase] WARN: The web application [ROOT] appears to have started a thread named [LeaseRenewer-14] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
 sun.misc.Unsafe.park(Native Method)
 java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
 java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:467)
 java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1066)
 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
 java.lang.Thread.run(Thread.java:745)

I have traced the problem to the com.amazonaws.services.kinesis.leases.impl.LeaseCoordinator.stop() method, which does not always shutdown the instance's leaseRenewalThreadpool field. (This field can also be final, BTW).

Moving the existing leaseRenewalThreadpool.shutdownNow() statement a few lines down to here seems to do the trick:

leaseRenewalThreadpool.shutdownNow();
synchronized (shutdownLock) {
    leaseRenewer.clearCurrentlyHeldLeases();
    running = false;
}

See pull #84.

@pfifer
Copy link
Contributor

pfifer commented Jul 13, 2016

Commented on the PR, but adding here as well.

The fix looks good, and I will be merging the changes in the near future. I don't yet have a an expected date for the next release.

@pfifer
Copy link
Contributor

pfifer commented Aug 5, 2016

PR #84 was merged, and released in v1.6.5.

@pfifer pfifer closed this as completed Aug 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants