Hello,
Working on my python-libusb1 wrapper, I notice that master branch cause
errors in my test suites across all tested python version (cpython 2.7,
3, pypy and pypy3):
https://travis-ci.org/github/vpelletier/python-libusb1/builds/746545930
(184.17 is a different failure)
The failure looks like:
python: os/threads_posix.h:62: usbi_mutex_destroy: Assertion `pthread_result == 0' failed.
Abandon (core dumped)
I have bisected it to the commit at the end of this email, which merely
adds the assertion which fails in my case.
Disabling tests which involve starting an event hanlding thread make
the error disappear.
The stack trace in produced coredump look like:
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f3731fc9537 in __GI_abort () at abort.c:79
#2 0x00007f3731fc940f in __assert_fail_base (fmt=0x7f3732132108 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7f3732359000 "pthread_result == 0",
file=0x7f373235bd14 "os/threads_posix.h", line=62, function=<optimized out>) at assert.c:92
#3 0x00007f3731fd85c2 in __GI___assert_fail (assertion=assertion@entry=0x7f3732359000 "pthread_result == 0", file=file@entry=0x7f373235bd14 "os/threads_posix.h", line=line@entry=62,
function=function@entry=0x7f373235af10 <__PRETTY_FUNCTION__.31> "usbi_mutex_destroy") at assert.c:101
#4 0x00007f3732350433 in usbi_mutex_destroy (mutex=0x296ea58) at os/threads_posix.h:62
#5 0x00007f3732352649 in usbi_mutex_destroy (mutex=<optimized out>) at io.c:1241
#6 usbi_io_exit (ctx=ctx@entry=0x296e980) at io.c:1234
#7 0x00007f373234decc in libusb_exit (ctx=0x296e980) at core.c:2441
In usbi_io_exit, poking at ctx I get 0x296ea58 to be the
flying_transfers_lock struct member:
(gdb) print &ctx->flying_transfers_lock
$2 = (usbi_mutex_t *) 0x296ea58
My test-case does not submit any transfers, and joins with the thread
before exiting.
What could I be doing wrong to cause this error ?
11cc9952823fbb47b7596aec30a205f68f3a8062 is the first bad commit
commit 11cc9952823fbb47b7596aec30a205f68f3a8062
Author: Chris Dickens <chr...@gm...>
Date: Wed Aug 26 17:42:59 2020 -0700
core: Simplify thread abstractions and add debug checks
The POSIX thread mutex initialization function can potentially fail, but
in practice this is unlikely to occur. There is also inconsistent use of
the result of the mutex initialization within the library. The result is
only checked for mutexes in the libusb_device and libusb_device_handle
structures but is ignored in all other cases.
Simplify the mutex initialization function by changing the abstraction's
wrapper to a void function, much like all the other functions that
already exist. To that end, introduce macros for the abstractions that
will check the return value on debug builds.
Also remove the dependence on the core library needing errno.h to
translate errors from usbi_cond_timedwait(). The abstraction will
convert the implementation-specific error codes to LIBUSB_ERROR values.
Signed-off-by: Chris Dickens <chr...@gm...>
libusb/core.c | 19 +++----------------
libusb/io.c | 9 ++++-----
libusb/os/threads_posix.c | 20 ++++++++++++++------
libusb/os/threads_posix.h | 38 ++++++++++++++++++++++----------------
libusb/os/threads_windows.c | 4 ++--
libusb/os/threads_windows.h | 28 +++++++++++++---------------
libusb/version_nano.h | 2 +-
7 files changed, 59 insertions(+), 61 deletions(-)
--
Vincent Pelletier
|