Description
There can be a race condition where shut down is called on a StreamThread then shut down is called on a GlobalStreamThread, but the StreamThread can be delayed in shutting down, and the GlobalStreamThread can shutdown first.
If the StreamThread tries to access a GlobalStateStore before closing the user can get an exception stating "..Store xxx is currently closed "
Here's a redacted partial log file showing this process:
2018-04-23 12:54:10 [INFO] [logger] DataExportTopology:86 - Closing streams
2018-04-23 12:54:10 [INFO] [logger] KafkaStreams:346 - stream-client [redacted-info] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-1] Informed to shut down
2018-04-23 12:54:10 [INFO] [logger] StreamThread:346 - stream-thread [redacted-info-StreamThread-1] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-2] Informed to shut down
2018-04-23 12:54:10 [INFO] [logger] StreamThread:346 - stream-thread [redacted-info-StreamThread-2] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-3] Informed to shut down
2018-04-23 12:54:10 [INFO] [logger] StreamThread:346 - stream-thread [redacted-info-StreamThread-3] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-4] Informed to shut down
2018-04-23 12:54:10 [INFO] [logger] StreamThread:346 - stream-thread [redacted-info-StreamThread-4] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] GlobalStreamThread:346 - global-stream-thread [redacted-info-GlobalStreamThread] State transition from RUNNING to PENDING_SHUTDOWN
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-4] Shutting down
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-1] Shutting down
2018-04-23 12:54:10 [INFO] [logger] GlobalStreamThread:336 - global-stream-thread [redacted-info-GlobalStreamThread] Shutting down
2018-04-23 12:54:10 [INFO] [logger] GlobalStreamThread:346 - global-stream-thread [redacted-info-GlobalStreamThread] State transition from PENDING_SHUTDOWN to DEAD
2018-04-23 12:54:10 [INFO] [logger] GlobalStreamThread:336 - global-stream-thread [redacted-info-GlobalStreamThread] Shutdown complete
2018-04-23 12:54:10 [INFO] [logger] StreamThread:336 - stream-thread [redacted-info-StreamThread-2] Shutting down
Attachments
Issue Links
- links to