Skip to content
Snippets Groups Projects
Commit 2abe7c3f authored by Nadav Har'El's avatar Nadav Har'El Committed by Pekka Enberg
Browse files

tst-queue-mpsc: fix one bug in the test.


The second stack trace mentioned in issue #178 happens because of a
bug in tst-queue-mpsc (this is what happens when tests become too
complex, and have bugs of their own...):

The "popper" thread reads an "item" from a lockfree:queue_mpsc, and wakes
the "pusher" thread in that item. But we have a bug when the pusher thread
is done and returns: While the condvar remains valid, the "item" containing
it does not! We cannot continue to use the index item->value.waiter after
we woke this thread, because it can return and item points to invalid
memory... We need to save the index "item->value.waiter" before waking
the thread.

Unfortunately, this does *not* completely solve issue #178 - the timer
bug (similar to the two stack traces on issue #178) is still seen
(rarely) after this patch.

Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
parent 9ed4ab4c
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment