Bug 482 - Using multiple contexts in different threads generates a segfault.
Summary: Using multiple contexts in different threads generates a segfault.
Status: CONFIRMED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: API (show other bugs)
Version: unreleased development snapshot
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 23:19 CET by jens.steinhauser
Modified: 2015-10-20 22:21 CEST (History)
1 user (show)



Attachments
script to demonstrate the problem (973 bytes, text/x-python)
2014-11-18 23:19 CET, jens.steinhauser
Details
Backtrace when using the 'demo' driver. (11.29 KB, text/plain)
2014-11-18 23:20 CET, jens.steinhauser
Details
Backtrace when using the 'serial-dmm' driver. (11.20 KB, text/plain)
2014-11-18 23:21 CET, jens.steinhauser
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jens.steinhauser 2014-11-18 23:19:10 CET
Created attachment 96 [details]
script to demonstrate the problem

The attached script starts a separate thread to run 'session.run()'. If then in the main thread another libsigrok context object is created, the program segfaults.

The segfault occurs both when using the demo and the serial-dmm driver.
Comment 1 jens.steinhauser 2014-11-18 23:20:23 CET
Created attachment 97 [details]
Backtrace when using the 'demo' driver.

I made it crash multiple times, it always crashed in the 'g_hash_table_iter_init()' function.
Comment 2 jens.steinhauser 2014-11-18 23:21:40 CET
Created attachment 98 [details]
Backtrace when using the 'serial-dmm' driver.

I made it crash multiple times, it always crashed in an unknown function called from 'sr_session_stop_sync()'.
Comment 3 Martin Ling 2015-10-20 22:21:59 CEST
I'd be surprised if this is a bug in the Python bindings or even in the underlying C++ bindings.

Support for even the existence of multiple contexts, let alone concurrent usage, is theoretical at best in libsigrok.

I would suggest trying to reproduce this issue first with a C++ program, and then with a C one. My guess is the problem will remain.

Reassigning this bug from python bindings to API.