awslabs/amazon-kinesis-client

Worker does not complete shutdown on request when it is without active lease.

garfieldatwork opened this issue · 1 comments

The scenario is -
a) I have a cluster of Workers (size n) against a Stream (shard count m). m < n. So some Workers are without active lease.
b) On doing requestShutdown(), the worker returns an immediateFuture
c) Since ShutdownFuture is not returned, shutdown() for Worker is never called which is normally done here
d) Worker does not stop.

A work-around I am doing is to always call shutdown() for the worker after doing a get() on the future. However, a proper fix seems to do the following in requestShutdown() -

        if (leases == null || leases.isEmpty()) {
            //
            // If there are no leases shutdown is already completed.
            //
            shutdown();
            return Futures.immediateFuture(null);
        }

Since there is no lease, shutdown() should be quick.

An alternate solution will be - to return ShutdownFuture in all scenarios with minor changes.

Suggestions?

This has been fixed in release 1.7.4. Please reopen if you are still seeing this occur.