Reproduce with
I can reproduce it with this command and it occurs about 50% of the time:
python sandy.py
sandy.py
import explorerhat as eh
from time import sleep
def touchpad(ch, ev):
print "Got {} on {}".format(ev, ch)
eh.touch.pressed(touchpad)
while True:
sleep(1)
#end
Output
(1st run ok, 2nd run segfault)
pi@raspberrypi:~/logger $ python sandy.py
Explorer HAT Pro detected...
Got press on 1
Got press on 2
Got press on 3
Got press on 4
^CTraceback (most recent call last):
File "sandy.py", line 10, in
sleep(1)
KeyboardInterrupt
Explorer HAT exiting cleanly, please wait...
Stopping flashy things...
Stopping user tasks...
Cleaning up...
Goodbye!
Segmentation fault (core dumped)
pi@raspberrypi:~/logger $
GDB backtrace
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `python sandy.py'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x76a07c9c in output_gpio () from /usr/lib/python2.7/dist-packages/RPi/_GPIO.arm-linux-gnueabihf.so
(gdb) backtrace
#0 0x76a07c9c in output_gpio () from /usr/lib/python2.7/dist-packages/RPi/_GPIO.arm-linux-gnueabihf.so
#1 0x76a0989c in pwm_thread () from /usr/lib/python2.7/dist-packages/RPi/_GPIO.arm-linux-gnueabihf.so
#2 0x7e836908 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb)
Thoughts?
Since occurance is not 100%, I am thinking it could be a race -- possibly with a callback using freed memory.
pi@raspberrypi:~/logger $ python --version
Python 2.7.9