Fix: session destruction blocks indefinitely if rotation is ongoing
Issue
---
The destruction of an active session can hang indefinitely if it
occurs while a rotation is ongoing. This was observed when automatic
session rotations were scheduled on a time basis.
The destruction of the session causes it to be stopped. The 'stop'
command causes the session's timers to be stopped. These timers
include the rotation pending check timer.
Meanwhile, 'data pending' queries are performed against the session
until one of them returns that no data is pending.
The 'data pending' check returns that data is pending if a session
rotation is ongoing at the moment of the check.
Hence, stopping the rotation completion check timer causes the
session to remain in the 'session ongoing' state forever and
prevents the session destruction from completing.
Solution
---
The session's rotation schedule timer is correctly stopped when
a 'stop' is performed; we don't want new rotations to be issued
from this point. However, it is incorrect to stop the
'rotation pending check' timer at this stage if a rotation is
ongoing.
This commit leaves the 'rotation pending check' timer running,
allowing the rotation thread to update the session's rotation
state on completion of the rotation. The operations that were
performed as part of the stop command, namely renaming the
'current' chunk, are then performed from the context of the
rotation thread.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
This page took 0.026596 seconds and 5 git commands to generate.