Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault calling python-mbus #10

Open
sjlongland opened this issue Dec 2, 2015 · 3 comments
Open

segfault calling python-mbus #10

sjlongland opened this issue Dec 2, 2015 · 3 comments

Comments

@sjlongland
Copy link
Contributor

Just running the tests that come with python-mbus causes the Python interpreter to segfault.

libmbus is git head as of this morning, tried both with commit widesky/libmbus@716d712 and widesky/libmbus@ef6c4be. libmbus itself appears to work judging from the test/example programs it comes with, so it looks to be something funny with python-mbus.

RC=0 stuartl@rikishi /tmp/python-mbus $ py.test 
======================================================================== test session starts ========================================================================
platform linux2 -- Python 2.7.7 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/python-mbus, inifile: pytest.ini
plugins: cov
collected 16 items 

tests/test_MBus_connect.py Segmentation fault

Changes to python-mbus:

diff --git a/mbus/MBus.py b/mbus/MBus.py
index 7f26165..671a18f 100644
--- a/mbus/MBus.py
+++ b/mbus/MBus.py
@@ -60,7 +60,7 @@ class MBus:
                 raise TypeError("port number not given as integer")

         if None == libpath:
-            libpath = "/usr/local/lib/libmbus.so"
+            libpath = "/usr/local/lib64/libmbus.so"

         self._libmbus = cdll.LoadLibrary(libpath)

diff --git a/pytest.ini b/pytest.ini
index f84356a..0cd849c 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,8 +1,8 @@
 [pytest]
-addopts = --pep8 --cov-config .coveragerc --cov . tests/
+addopts = --cov-config .coveragerc --cov . tests/

-serialdevice = /dev/adjustme
+serialdevice = /dev/ttyS0
 ;serialdevice = /dev/ttyUSB0

 markers =
-       serial: mark a test to be run with serial device attached
\ No newline at end of file
+       serial: mark a test to be run with serial device attached
@sjlongland
Copy link
Contributor Author

Managed to get a sort-of backtrace. gdb doesn't want to give me the Python backtrace but it seems to come acroppa when it tries to connect:

(gdb) run
Starting program: /usr/bin/python /usr/bin/py.test
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
process 26210 is executing new program: /usr/bin/python2.7
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
======================================================================== test session starts ========================================================================
platform linux2 -- Python 2.7.7 -- py-1.4.30 -- pytest-2.7.2
rootdir: /tmp/python-mbus, inifile: pytest.ini
plugins: cov
collected 16 items 

tests/test_MBus_connect.py 
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff1a71be1 in mbus_connect (handle=0x5598fc80) at mbus-protocol-aux.c:1589
1589        return handle->open(handle);
(gdb) 

@sjlongland
Copy link
Contributor Author

Further research suggests it might be this bug: https://bugs.python.org/issue11835

I'll try a Python update and see what happens.

@sjlongland
Copy link
Contributor Author

Okay, after Python update, same thing. I think this might be a bug in the Python package.

RC=0 stuartl@rikishi ~/vrt/projects/metermaster/deps/python-mbus $ gdb --args /usr/bin/python /usr/bin/py.test 
GNU gdb (Gentoo 7.7.1 p1) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/bin/python...(no debugging symbols found)...done.
(gdb) r
Starting program: /usr/bin/python /usr/bin/py.test
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
process 5971 is executing new program: /usr/bin/python2.7
warning: Could not load shared library symbols for linux-vdso.so.1.
Do you need "set solib-search-path" or "set sysroot"?
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
======================================================================== test session starts ========================================================================
platform linux2 -- Python 2.7.10 -- py-1.4.30 -- pytest-2.7.2
rootdir: /home/stuartl/vrt/projects/metermaster/deps/python-mbus, inifile: pytest.ini
plugins: cov
collected 16 items 

tests/test_MBus_connect.py 
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff19f5be1 in mbus_connect (handle=0x573e00a0) at mbus-protocol-aux.c:1589
1589    mbus-protocol-aux.c: No such file or directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant