advice on debugging a segfault

Barry barry at barrys-emacs.org
Sun Jan 17 16:24:59 EST 2021


Run python under gdb and when the segv  happens use
the gdb bt command to get a stack trace.

Also if gdb says that it needs debug symbols install you will need to
do that. Otherwise the not will not contain symbols.

Barry

> On 17 Jan 2021, at 19:58, Robin Becker <robin at reportlab.com> wrote:
> 
> I have a segfault in the 3.10 alpha 4 when running the reportlab document generation; all the other tests seem to have worked. I would like to ask experts here how to approach getting the location of the problem. I run recent archlinux.
> 
> Below is the output of  a test run with -Xdev -Xtracemalloc; the main process is almost finished so the error appears to come from trying to free resources
> 
>> $ python -Xdev -Xtracemalloc genuserguide.py /home/robin/devel/reportlab/.py310/lib/python3.10/distutils/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
>>  import imp
>> Built story contains 1843 flowables...
>> Saved "/home/robin/devel/reportlab/REPOS/reportlab/docs/reportlab-userguide.pdf"
>> [ Top 10 ]
>> <frozen importlib._bootstrap_external>:630: size=10.5 MiB, count=105832, average=104 B
>> /home/robin/devel/reportlab/reportlab/lib/abag.py:19: size=7161 KiB, count=27126, average=270 B
>> /home/robin/devel/reportlab/reportlab/platypus/paraparser.py:3141: size=3364 KiB, count=5980, average=576 B
>> /home/robin/devel/reportlab/.py310/lib/python3.10/site-packages/pyphen/__init__.py:160: size=2905 KiB, count=41797, average=71 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:776: size=1386 KiB, count=32208, average=44 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:92: size=1384 KiB, count=26248, average=54 B
>> /home/robin/devel/reportlab/.py310/lib/python3.10/copy.py:280: size=1232 KiB, count=8827, average=143 B
>> /home/robin/devel/reportlab/reportlab/platypus/frames.py:155: size=1101 KiB, count=1173, average=962 B
>> <frozen importlib._bootstrap>:241: size=915 KiB, count=8146, average=115 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:773: size=881 KiB, count=16104, average=56 B
>> sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='../images/replogo.gif'>
>> sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='../images/testimg.gif'>
>> Debug memory block at address p=0x5617c33effe0: API ''
>>    0 bytes originally requested
>>    The 7 pad bytes at p-7 are not all FORBIDDENBYTE (0xfd):
>>        at p-7: 0x00 *** OUCH
>>        at p-6: 0x00 *** OUCH
>>        at p-5: 0x00 *** OUCH
>>        at p-4: 0x00 *** OUCH
>>        at p-3: 0x00 *** OUCH
>>        at p-2: 0x00 *** OUCH
>>        at p-1: 0x00 *** OUCH
>>    Because memory is corrupted at the start, the count of bytes requested
>>       may be bogus, and checking the trailing pad bytes may segfault.
>>    The 8 pad bytes at tail=0x5617c33effe0 are not all FORBIDDENBYTE (0xfd):
>>        at tail+0: 0x00 *** OUCH
>>        at tail+1: 0x00 *** OUCH
>>        at tail+2: 0x00 *** OUCH
>>        at tail+3: 0x00 *** OUCH
>>        at tail+4: 0x00 *** OUCH
>>        at tail+5: 0x00 *** OUCH
>>        at tail+6: 0x00 *** OUCH
>>        at tail+7: 0x00 *** OUCH
>> Enable tracemalloc to get the memory block allocation traceback
>> Fatal Python error: _PyMem_DebugRawFree: bad ID: Allocated using API '', verified using API 'o'
>> Python runtime state: finalizing (tstate=0x5617c53c8b30)
>> Current thread 0x00007fd5742b3740 (most recent call first):
>> <no Python frame>
>> Aborted (core dumped)
> 
> 
> for comparison here is the 3.9.1 output> $ python -Xdev -Xtracemalloc genuserguide.py
>> /home/robin/devel/reportlab/.py39/lib/python3.9/distutils/__init__.py:1: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
>>  import imp
>> /home/robin/devel/reportlab/.py39/lib/python3.9/site-packages/fontTools/misc/py23.py:11: DeprecationWarning: The py23 module has been deprecated and will be removed in the next release. Please update your code.
>>  warnings.warn(
>> Built story contains 1843 flowables...
>> Saved "/home/robin/devel/reportlab/REPOS/reportlab/docs/reportlab-userguide.pdf"
>> [ Top 10 ]
>> <frozen importlib._bootstrap_external>:587: size=12.4 MiB, count=128010, average=102 B
>> /home/robin/devel/reportlab/reportlab/lib/abag.py:19: size=7132 KiB, count=26951, average=271 B
>> /home/robin/devel/reportlab/reportlab/platypus/paraparser.py:3141: size=3364 KiB, count=5980, average=576 B
>> /home/robin/devel/reportlab/.py39/lib/python3.9/site-packages/pyphen/__init__.py:160: size=2905 KiB, count=41797, average=71 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:776: size=1386 KiB, count=32208, average=44 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:92: size=1384 KiB, count=26248, average=54 B
>> /home/robin/devel/reportlab/.py39/lib/python3.9/copy.py:279: size=1230 KiB, count=8827, average=143 B
>> /home/robin/devel/reportlab/reportlab/platypus/frames.py:155: size=1039 KiB, count=957, average=1112 B
>> <frozen importlib._bootstrap>:228: size=959 KiB, count=8503, average=116 B
>> /home/robin/devel/reportlab/reportlab/platypus/paragraph.py:773: size=881 KiB, count=16104, average=56 B
>> sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='../images/replogo.gif'>
>> sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='../images/testimg.gif'>
> 
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 



More information about the Python-list mailing list