Fix: session destruction blocks indefinitely if rotation is ongoing
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Oct 2018 12:47:52 +0000 (13:47 +0100)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Oct 2018 15:10:44 +0000 (16:10 +0100)
commit9402c5b93a3e3344612a9938878bddb1430a3418
tree45e5311f366771ea3fdc09ea74c858269853a593
parente94fecfcf3a8607771a6adf38f3ba0a686ddd683
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>
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/rotate.c
src/bin/lttng-sessiond/rotate.h
src/bin/lttng-sessiond/rotation-thread.c
This page took 0.025568 seconds and 4 git commands to generate.