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.

classification
Title: PYTHONDUMPREFS=1 ./python -c pass does crash
Type: Stage: resolved
Components: Interpreter Core Versions: Python 3.8
process
Status: closed Resolution: duplicate
Dependencies: Superseder: PYTHONDUMPREFS segfaults on exit
View: 30156
Assigned To: Nosy List: vstinner, xtreak
Priority: normal Keywords:

Created on 2018-07-25 13:53 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (5)
msg322353 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-07-25 13:53
It seems like Python has an invalid object somewhere. PYTHONDUMPREFS=1 makes Python crash at exit.

$ PYTHONDUMPREFS=1 ./python -c pass
(...)
0x7f1992292448 [1] (<class '_thread._localdummy'>, <class 'object'>)
0x7f1992241aa8 [1] {'__doc__': 'Thread-local dummy'}
0x7f199222c740 [1] (<class 'object'>,)
0x9c98a0 [2] <class '_thread._localdummy'>
0x7f1992217dc0 [1] 
Segmentation fault (core dumped)
msg322358 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-07-25 14:36
Can reproduce this on Python 3.5 and 3.6 too

# Python 3.5

➜  cpython git:(f497e74) $ ./python
Python 3.5.6rc1+ (remotes/upstream/3.5:f497e74, Jul 25 2018, 14:32:33)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
➜  cpython git:(f497e74) $ PYTHONDUMPREFS=1 ./python -c pass
(...)
0x7f9bac534478 [1] 'Thread-local data'
0x7f9bac538d78 [1] (<class '_thread._local'>, <class 'object'>)
0x7f9bac5343a0 [1] <built-in method __new__ of type object at 0x8b1a00>
0x7f9bac53d358 [1] <slot wrapper '__delattr__' of '_thread._local' objects>
0x7f9bac53d2d8 [1] <slot wrapper '__setattr__' of '_thread._local' objects>
0x7f9bac53d258 [1] <slot wrapper '__getattribute__' of '_thread._local' objects>
0x7f9bac541288 [1] {'__getattribute__': <slot wrapper '__getattribute__' of '_thread._local' objects>, '__delattr__': <slot wrapper '__delattr__' of '_thread._local' objects>, '__new__': <built-in method __new__ of type object at 0x8b1a00>, '__setattr__': <slot wrapper '__setattr__' of '_thread._local' objects>, '__doc__': 'Thread-local data'}
0x7f9bac53b398 [1] (<class 'object'>,)
0x8b1a00 [6] <class '_thread._local'>
0x7f9bac53d1d8 [1] <weakref at 0x7f9bac53d1d8; to 'type' at 0x8b1ba0 (_localdummy)>
0x7f9bac537270 [1] 9116576
0x7f9bac534400 [1] 'Thread-local dummy'
0x7f9bac538c28 [1] (<class '_thread._localdummy'>, <class 'object'>)
0x7f9bac541218 [1] {'__doc__': 'Thread-local dummy'}
0x7f9bac53b330 [1] (<class 'object'>,)
0x8b1ba0 [2] <class '_thread._localdummy'>
0x7f9bac598ef8 [1] [1]    15208 segmentation fault (core dumped)  PYTHONDUMPREFS=1 ./python -c pass

# Python 3.6


cpython git:(a096cc6) $ ./python
Python 3.6.6+ (remotes/upstream/3.6:a096cc6, Jul 25 2018, 14:28:43)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

➜  cpython git:(a096cc6) $ PYTHONDUMPREFS=1 ./python -c pass
0x7fab5a968758 [1] <weakref at 0x7fab5a968758; to 'type' at 0x8b7f60 (_localdummy)>
0x7fab5a965310 [1] 9142112
0x7fab5a962568 [1] 'Thread-local dummy'
0x7fab5a960c28 [1] (<class '_thread._localdummy'>, <class 'object'>)
0x7fab5a962508 [1] {'__doc__': 'Thread-local dummy'}
0x7fab5a95f128 [1] (<class 'object'>,)
0x8b7f60 [2] <class '_thread._localdummy'>
0x7fab5a9622b0 [1] {'__name__': None, '__doc__': None, '__package__': None, '__loader__': None, '__spec__': None, 'warn': None, 'warn_explicit': None, '_filters_mutated': None, 'filters': None, '_onceregistry': None, '_defaultaction': None}
0x7fab5a9686d8 [1]
0x7fab5a966740 [1] '_warnings'
0x7fab5a9497a8 [1] [1]    2975 segmentation fault (core dumped)  PYTHONDUMPREFS=1 ./python -c pass



Thanks
msg322359 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-07-25 14:42
Python 3.4 seems fine

➜  cpython git:(57b85d3) ./python
Python 3.4.9rc1+ (default, Jul 25 2018, 14:39:07)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

➜  cpython git:(57b85d3) time PYTHONDUMPREFS=1 ./python -c pass
(...)
0x7fbe97f52110 [57] str
0x7fbe97f520a8 [57] str
0x7fbe97f52040 [39] str
0x7fbe97f50350 [23] str
0x7fbe97f502e0 [48] str
0x7fbe97f50270 [143] str
0x7fbe97f50200 [24] str
0x7fbe97f50190 [24] str
0x7fbe97f50120 [8] str
0x7fbe97f500c8 [1] dict
0x7fbe97f51040 [138] str
0x7fbe97f50058 [1] dict
0x7fbe97f4f058 [154] tuple
0x86c6e0 [381] type
0x86cb00 [31] type
PYTHONDUMPREFS=1 ./python -c pass  0.08s user 0.08s system 45% cpu 0.342 total


Thanks
msg322363 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2018-07-25 15:02
Seems like this is the same as https://bugs.python.org/issue30156. 

Relevant commit : https://github.com/python/cpython/commit/7822f151b68e40376af657d267ff774439d9adb9 . 
Comment on the commit : https://github.com/python/cpython/commit/7822f151b68e40376af657d267ff774439d9adb9#commitcomment-21880815

Python 3.5.1 works fine but Python 3.5.2rc1 will crash.

# Python 3.5.2rc1 crash

$ git checkout v3.5.2rc1 && git clean -xdf && time ./configure --with-pydebug && make -s -j4 && PYTHONDUMPREFS=1 ./python -c pass
(...)
0x7f8915f0b258 [1] <slot wrapper '__getattribute__' of '_thread._local' objects>
0x7f8915f0d3d8 [1] {'__setattr__': <slot wrapper '__setattr__' of '_thread._local' objects>, '__doc__': 'Thread-local data', '__delattr__': <slot wrapper '__delattr__' of '_thread._local' objects>, '__getattribute__': <slot wrapper '__getattribute__' of '_thread._local' objects>, '__new__': <built-in method __new__ of type object at 0x8ad8e0>}
0x7f8915f09260 [1] (<class 'object'>,)
0x8ad8e0 [6] <class '_thread._local'>
0x7f8915f0b1d8 [1] <weakref at 0x7f8915f0b1d8; to 'type' at 0x8ada80 (_localdummy)>
0x7f8915f05270 [1] 9099904
0x7f8915f00298 [1] 'Thread-local dummy'
0x7f8915f06d78 [1] (<class '_thread._localdummy'>, <class 'object'>)
0x7f8915f0d368 [1] {'__doc__': 'Thread-local dummy'}
0x7f8915f091f8 [1] (<class 'object'>,)
0x8ada80 [2] <class '_thread._localdummy'>
0x7f8915f0d218 [1] {'_filters_mutated': None, 'warn': None, 'warn_explicit': None, '__spec__': None, '_defaultaction': None, '__loader__': None, 'filters': None, '__package__': None, '__doc__': None, '_onceregistry': None, '__name__': None}
0x7f8915f0b158 [1]
0x7f8915f0d190 [1] '_warnings'
0x7f8915f65e28 [1] [1]    8258 segmentation fault (core dumped)  PYTHONDUMPREFS=1 ./python -c pass


# Python 3.5.1 works fine

$ git checkout v3.5.1 && git clean -xdf && time ./configure --with-pydebug && make -s -j4 && PYTHONDUMPREFS=1 ./python -c pass
(...)
0x7f60ba2e51e0 [58] str
0x7f60ba2e5178 [67] str
0x7f60ba2e5110 [58] str
0x7f60ba2e50a8 [58] str
0x7f60ba2e5040 [38] str
0x7f60ba2e3350 [22] str
0x7f60ba2e32e0 [51] str
0x7f60ba2e3270 [156] str
0x7f60ba2e3200 [22] str
0x7f60ba2e3190 [22] str
0x7f60ba2e3120 [6] str
0x7f60ba2e30c8 [1] dict
0x7f60ba2e4040 [142] str
0x7f60ba2e3058 [1] dict
0x7f60ba2e2058 [352] tuple
0x8986e0 [423] type


Thanks
msg326252 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-09-24 15:37
I mark this issue as a duplicate of 30156.
History
Date User Action Args
2022-04-11 14:59:03adminsetgithub: 78404
2018-09-24 15:37:50vstinnersetstatus: open -> closed
superseder: PYTHONDUMPREFS segfaults on exit
messages: + msg326252

resolution: duplicate
stage: resolved
2018-07-25 15:02:01xtreaksetmessages: + msg322363
2018-07-25 14:42:06xtreaksetmessages: + msg322359
2018-07-25 14:36:48xtreaksetnosy: + xtreak
messages: + msg322358
2018-07-25 13:53:37vstinnercreate