awslabs / amazon-kinesis-client-ruby

A Ruby interface for the Amazon Kinesis Client Library. Allows developers to easily create robust application to process Amazon Kinesis streams in Ruby.
Apache License 2.0
146 stars 56 forks source link

GracefulShutdown fails #36

Closed aelaa closed 4 years ago

aelaa commented 5 years ago

Tried to run on both my application and sample from this repo. Every time I'm trying to stop the application, I see next message:

2019-04-04 10:36:23,894 [RequestedShutdownThread] INFO  s.a.k.c.GracefulShutdownCoordinator$GracefulShutdownCallable [NONE] - Shutdown completed, but shutdownCompleteLatch still had outstanding 2 with a current value of 2. shutdownComplete: false -- Consumer Map: 0

I suppose application's stopping properly, but KCL still waits for something. Is it OK?

Cory-Bradshaw commented 4 years ago

Graceful shutdowns attempts allowing the running record processors to finish the work they are doing. If the consumers are particularly long running you may need to force the shutdown non-gracefully.

This message is saying that there were 2 consumers running, and 2 that are still running. The shutdown did not complete. You can either try calling the graceful shutdown again and await the consumers to finish their work, or you can more forcibly shutdown the worker.

Per our docs:

https://docs.aws.amazon.com/streams/latest/dev/kinesis-record-processor-implementation-app-java.html

If the shutdown reason is TERMINATE, the record processor should finish processing 
any data records, and then call the checkpoint method on this interface.

If you continue to experience problems with shutting down a KCL worker, you can open an AWS Support case in the AWS Console to provide more information around configuration, use case, and the code you are using and we can try our best to help troubleshoot the problems you are seeing.