Phoenix icon indicating copy to clipboard operation
Phoenix copied to clipboard

Segfault on exit with version 4.2.1 and Python 3.12

Open nilason opened this issue 2 years ago • 4 comments
trafficstars

Operating system: macOS 13.6.1 22G313 arm64 wxPython version & source: 4.2.1 (pypi and self-built) Python version & source: Python 3.12.0 (official Mac dist and MacPorts' built)

Description of the problem:

Exiting/quitting a Python 3.12 session with wxPython loaded causes segmentation fault:

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Codes:       0x0000000000000001, 0x0000000000000010

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [64502]

VM Region Info: 0x10 is not in any region.  Bytes before following region: 105553518919664
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   Python                        	       0x1016b823c _PyObject_Free + 36
1   siplib.cpython-312-darwin.so  	       0x10159f570 finalise + 132 (siplib.c:2064)
2   Python                        	       0x1017a020c Py_FinalizeEx + 452
3   Python                        	       0x1017a1780 Py_Exit + 20
4   Python                        	       0x1017a8b50 handle_system_exit + 44
5   Python                        	       0x1017a8004 _PyErr_PrintEx + 56
6   Python                        	       0x1017a7d30 PyRun_SimpleStringFlags + 144
7   Python                        	       0x1017cad48 pymain_run_command + 148
8   Python                        	       0x1017ca6f0 Py_RunMain + 244
9   Python                        	       0x1017cab00 Py_BytesMain + 40
10  dyld                          	       0x198fc3f28 start + 2236

Above log extract is from self-built wxPython with MacPorts' Python (with SIP 6.7.12), but nearly identical with official Python dist with pypi version of wxPython.

The same procedure works as expected with Python <=3.11.

Code Example (click to expand)
import wx
exit()

macports_build.log.txt official_dist.log.txt

nilason avatar Nov 14 '23 10:11 nilason

I can reproduce this with the 4.2.1 wheels, but not with the latest snapshot builds so it seems likely it was fixed by a sip update.

swt2c avatar Dec 01 '23 15:12 swt2c

Possible duplicate of https://github.com/wxWidgets/Phoenix/issues/2455.

quarthex avatar Dec 04 '23 11:12 quarthex

Possible duplicate of #2455.

Sure looks like it. Perhaps better to keep this ticket open till next release, to avoid new reports.

nilason avatar Dec 04 '23 11:12 nilason

Yes. It also reproduced on Linux :penguin:.

quarthex avatar Dec 04 '23 12:12 quarthex