This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Howard_Landman
Recipients Howard_Landman
Date 2020-07-18.18:38:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1595097501.98.0.660179014456.issue41335@roundup.psfhosted.org>
In-reply-to
Content
I have a program qtd.py that reliably dies with free(): invalid pointer after about 13 hours of runtime (on a RPi3B+). This is hard to debug because (1) try:except: will not catch SIGABRT
(2) signal.signal(signal.SIGABRT, sigabrt_handler) also fails to catch SIGABRT
(3) python3-dbg does not work with libraries like RPi.GPIO and spidev()
This happens under both Buster and Stretch, so I don't think it's OS-dependent.

I managed to get a core dump and gdb back trace gives:
warning: core file may not match specified executable file.
[New LWP 10277]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `python3 qtd.py'.
Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x76c5e308 in __GI_abort () at abort.c:100
#2  0x76cae51c in __libc_message (action=action@entry=do_abort, 
    fmt=<optimized out>) at ../sysdeps/posix/libc_fatal.c:181
#3  0x76cb5044 in malloc_printerr (str=<optimized out>) at malloc.c:5341
#4  0x76cb6d50 in _int_free (av=0x76d917d4 <main_arena>, 
    p=0x43417c <small_ints.lto_priv+72>, have_lock=<optimized out>)
    at malloc.c:4165
#5  0x001b3bb4 in list_ass_item (a=<optimized out>, i=<optimized out>, 
    v=<optimized out>, a=<optimized out>, i=<optimized out>, v=<optimized out>)
    at ../Objects/listobject.c:739
Backtrace stopped: Cannot access memory at address 0x17abeff8

So, as far as I can tell, it looks like list_ass_item() is where the error happens. I'm willing to help debug and maybe even fix this, but is there any way to remove any of the roadblocks (1-3) above?

NOTE: qtd.py will exit unless there is a Texas Instruments TDC7201 chip attached to the RPI's SPI pins.
History
Date User Action Args
2020-07-18 18:38:22Howard_Landmansetrecipients: + Howard_Landman
2020-07-18 18:38:21Howard_Landmansetmessageid: <1595097501.98.0.660179014456.issue41335@roundup.psfhosted.org>
2020-07-18 18:38:21Howard_Landmanlinkissue41335 messages
2020-07-18 18:38:21Howard_Landmancreate