Bug 1237 - Segfault in unit tests
Summary: Segfault in unit tests
Status: RESOLVED INVALID
Alias: None
Product: libsigrokdecode
Classification: Unclassified
Component: Build system (show other bugs)
Version: 0.5.1
Hardware: x86 Linux
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-19 16:48 CEST by marian.buschsieweke
Modified: 2019-06-12 13:35 CEST (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description marian.buschsieweke 2018-06-19 16:48:23 CEST
Hi,

running the unit tests on Alpine Linux x86_64 (which uses musl instead of glibc as standard c library) I get a segfault when running the unit tests. I'm running the unit tests by "make check" from inside the source folder prior to the installation of libsigrokdecode, but libisgrok and libserialport are already installed when running.

This is the backtrace:

#0  0x00007ffff72fb1d2 in PySys_GetObject () from /usr/lib/libpython3.6m.so.1.0
#1  0x00007ffff7b624fd in srd_decoder_searchpath_add (path=path@entry=0x7ffff7b67e25 "/usr/share/libsigrokdecode/decoders") at srd.c:366
#2  0x00007ffff7b6278d in srd_init (path=0x0) at srd.c:256
#3  0x00005555555556a0 in test_init_exit_2 (_i=<optimized out>) at tests/core.c:56
#4  0x00007ffff795a4e5 in ?? () from /usr/lib/libcheck.so.0
#5  0x00007ffff795a852 in srunner_run_tagged () from /usr/lib/libcheck.so.0
#6  0x0000555555555333 in main (argc=<optimized out>, argv=<optimized out>) at tests/main.c:53

Kind regards,
Marian
Comment 1 Uwe Hermann 2018-06-19 19:56:59 CEST
Hm, I'm assuming this is something specific to the Python version or the distro.

While I can reproduce it on a quick VM test-image of Alpine Linux, it's not reproducible on various other distros.

Can you please try some other box / distro and see if it happens for you regardless of distro?

It *might* be a Python bug as well. One working box (Debian unstable x86_64) has 3.6.6r1, my Alpine Linux test-image has 3.6.3, changelog is here:

https://docs.python.org/3/whatsnew/changelog.html

The 3.6.4 changes include some low-level fixes and crashes in Python itself, maybe it's one of those. Potential candidates are e.g.

bpo-20891: Fix PyGILState_Ensure(). When PyGILState_Ensure() is called in a non-Python thread before PyEval_InitThreads(), only call PyEval_InitThreads() after calling PyThreadState_New() to fix a crash.
bpo-31532: Fix memory corruption due to allocator mix in getpath.c between Py_GetPath() and Py_SetPath()

If you can easily try another Python version, please do and report if that fixes the issue or not. Thanks!
Comment 2 marian.buschsieweke 2018-06-20 11:37:10 CEST
Hi,

thanks for the fast feedback. Actually, I'm using the edge version of Alpine Linux which includes Python 3.6.4 already. So the specific python bug you mentioned should not be the problem. I'll check with 3.6.5 and an older python version if the segfault persists.

Kind regards,
Marian
Comment 3 marian.buschsieweke 2019-06-12 13:35:10 CEST
Hi,

now that Alpine Linux is using python 3.7 sigrok works fine. Therefore, as Uwe Hermann suggested, this seems to be a python bug and not a sigrok bug. In any case it is now resolved for Alpine :-)

Kind regards,
Marian