Fix: add consumer wake up pipe to avoid race
authorDavid Goulet <dgoulet@efficios.com>
Wed, 19 Mar 2014 18:34:27 +0000 (14:34 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 1 Apr 2014 14:53:16 +0000 (10:53 -0400)
commit1bed03a237e1ee53b0ead2acb9a1c0a9065bdaf4
tree6e0ffbb3acf6a5ca7f6894e84db62b898ba7adcd
parentb0cbcf51b743a7a6979c3b1e27220a6d62af42bc
Fix: add consumer wake up pipe to avoid race

UST application will notify the wait_fd pipe for every subbuffer that it
writes and ready to be consumed. However, on *high* load systems, this
1:1 property can fail if the pipe gets filled up. For performance
reason, UST will ignore this error and continue since it can't wait for
the pipe to clear up.

This triggers a race condition where we have *one* wake up on the UST
pipe for potentially multiple subbuffers. A data pending command will
wait forever on streams that still has data but the data thread could'nt
consumed them because of this 1:n possible race. Using the stop command
without waiting would mean a memory/fd leak of the stream.

Thus, we add a consumer wake up pipe here that notifies the data thread
if there is still data to be read after a successful read subbuffer
call. With this, we end up handling the residual buffers if any since
the data thread is always notified when there is still data to be read.

Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/consumer.c
src/common/consumer.h
src/common/ust-consumer/ust-consumer.c
This page took 0.025169 seconds and 4 git commands to generate.