Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    2abe7c3f
    tst-queue-mpsc: fix one bug in the test. · 2abe7c3f
    Nadav Har'El authored
    
    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>
    2abe7c3f
    History
    tst-queue-mpsc: fix one bug in the test.
    Nadav Har'El authored
    
    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>