[New-bugs-announce] [issue41335] free(): invalid pointer in list_ass_item() in Python 3.7.3

Howard A. Landman report at bugs.python.org
Sat Jul 18 14:38:21 EDT 2020


New submission from Howard A. Landman <howard at riverrock.org>:

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 at 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 at 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 at 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.

----------
components: Interpreter Core
hgrepos: 389
messages: 373911
nosy: Howard_Landman
priority: normal
severity: normal
status: open
title: free(): invalid pointer in list_ass_item() in Python 3.7.3
type: crash
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41335>
_______________________________________


More information about the New-bugs-announce mailing list