Skip to content

Commit

Permalink
buffer: fix incorrect unlock of the buffer mutex (for deferred callba…
Browse files Browse the repository at this point in the history
…cks)

TSAN reports:
  WARNING: ThreadSanitizer: unlock of an unlocked mutex (or by a wrong thread) (pid=17111)
      #0 pthread_mutex_unlock /build/gcc/src/gcc/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3621 (libtsan.so.0+0x00000003b71c)
      libevent#1 evbuffer_add <null> (libevent_core-2.2.so.1+0x00000000ddb6)
      ...

    Mutex M392 (0x7b0c00000f00) created at:
      #0 pthread_mutex_init /build/gcc/src/gcc/libsanitizer/tsan/tsan_interceptors.cc:1117 (libtsan.so.0+0x0000000291af)
      libevent#1 <null> <null> (libevent_pthreads-2.2.so.1+0x000000000d46)
      ...

$ addr2line -e /lib/libevent_core-2.2.so.1 0x00000000ddb6
/src/libevent/buffer.c:1815 (discriminator 1)

Introduced-in: ae2b84b ("Replace
deferred_cbs with event_callback-based implementation.")
  • Loading branch information
azat committed Feb 12, 2018
1 parent f24b28e commit 93913da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ evbuffer_invoke_callbacks_(struct evbuffer *buffer)
evbuffer_incref_and_lock_(buffer);
if (buffer->parent)
bufferevent_incref_(buffer->parent);
EVBUFFER_UNLOCK(buffer);
}
EVBUFFER_UNLOCK(buffer);
}

evbuffer_run_callbacks(buffer, 0);
Expand Down

0 comments on commit 93913da

Please sign in to comment.