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

deletionThreadPool not closed in LeaseCleanupManager #796

Closed
yutian-wu opened this issue Mar 26, 2021 · 1 comment
Closed

deletionThreadPool not closed in LeaseCleanupManager #796

yutian-wu opened this issue Mar 26, 2021 · 1 comment

Comments

@yutian-wu
Copy link

yutian-wu commented Mar 26, 2021

Greetings,

As we were using the KCL 2.3 recently, we noticed that even after the scheduler has been shut down, part of the LeaseCleanupManager is still running, continuously logging this message:

Number of pending leases to clean before the scan : 0

After looking into the source code along with thread dump, I found that deletionThreadPool in LeaseCleanupManager is never closed.

deletionThreadPool.scheduleAtFixedRate(
  new LeaseCleanupThread(), INITIAL_DELAY, leaseCleanupIntervalMillis, TimeUnit.MILLISECONDS
);

More context at:

/~https://github.com/awslabs/amazon-kinesis-client/blob/master/amazon-kinesis-client/src/main/java/software/amazon/kinesis/leases/LeaseCleanupManager.java#L88

So I am creating this issue to have the problem tracked.

Thanks,

@turcsanyip
Copy link

turcsanyip commented Mar 26, 2021

I ran into the same issue with KCL 1.
1.14.x cannot stop cleanly but LeaseCleanupManager keeps running forever.
Versions up to 1.13.3 can stop properly.

As far as I can see, the root cause is this:

this.leaseCleanupManager = LeaseCleanupManager.newInstance(streamConfig.getStreamProxy(), leaseCoordinator.getLeaseManager(),
Executors.newSingleThreadScheduledExecutor(), metricsFactory, cleanupLeasesUponShardCompletion,

The Worker creates a ScheduledExecutorService for LeaseCleanupManager on the fly. As there is no reference to the executor, it cannot be stopped later.

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

3 participants