Bug #6466
openPython interactive interpreter seg-faults on tab completion
0%
Description
Hello,
I installed the Python package saxoncee ==12.4.2
in a Python 3.11.9 virtual environment, and upon trying to list the properties of an instance using tab completion, the interpreter crashed:
~ > uname -a
Darwin pooh 22.6.0 Darwin Kernel Version 22.6.0: Mon Apr 22 20:54:28 PDT 2024; root:xnu-8796.141.3.705.2~1/RELEASE_X86_64 x86_64 i386 Darwin
~ > PYTHONFAULTHANDLER=1 python
Python 3.11.9 (main, Apr 4 2024, 11:05:12) [Clang 14.0.3 (clang-1403.0.22.14.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import saxoncee
>>>
>>> saxon = saxoncee.PySaxonProcessor(license=False)
>>> document_builder = saxon.new_document_builder()
>>> node = document_builder.parse_xml(xml_text='<test/>')
>>>
>>> node.Fatal Python error: Segmentation fault
Current thread 0x00007ff843bdd7c0 (most recent call first):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/rlcompleter.py", line 189 in attr_matches
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/rlcompleter.py", line 92 in complete
Extension modules: saxoncee (total: 1)
Segmentation fault: 11
So on hitting the tab key on node.
the interpreter crashes.
This happens with and without registering the license with the Saxon Processor.
Files
Related issues
Updated by O'Neil Delpratt 5 months ago
- Category set to Python API
- Status changed from New to AwaitingInfo
- Found in version set to 12.4.2
Hi Jens,
Thank you for reporting the issue you found. The problem seems only to be on the SaxonC 12.4.2 release. I tried the same example with SaxonC 12.5 which was released a few days ago and the problem seems to have gone away.
See output with SaxonC 12.5:
>>> node.
node.add_xdm_item( node.column_number node.get_node_value( node.is_function node.name node.typed_value
node.attribute_count node.get_array_value( node.get_parent( node.is_map node.node_kind
node.attributes node.get_atomic_value( node.get_string_value( node.is_node node.node_kind_str
node.axis_nodes( node.get_attribute_value( node.head node.item_at( node.size
node.base_uri node.get_function_value( node.is_array node.line_number node.string_value
node.children node.get_map_value( node.is_atomic node.local_name node.to_string(
Updated by Jens Troeger 5 months ago
Thanks O’Neil! I can confirm that, after installing saxoncee ==12.5.0
, I was able to tab complete.
But, I also noticed that saxoncee.__version__
is missing, which is common to denote a package’s version (see also PEP-8).
Updated by O'Neil Delpratt 5 months ago
- Related to Bug #6468: saxoncee.__version__ is missing added
Updated by O'Neil Delpratt 5 months ago
Jens Troeger wrote in #note-2:
Thanks O’Neil! I can confirm that, after installing
saxoncee ==12.5.0
, I was able to tab complete.But, I also noticed that
saxoncee.__version__
is missing, which is common to denote a package’s version (see also PEP-8).
I have created the bug issue to track the progress of __version__
: #6468
Updated by O'Neil Delpratt 5 months ago
- Status changed from AwaitingInfo to Rejected
Updated by Martin Honnen 5 months ago
In a Linux Ubuntu WSL shell with SaxonCHE 12.5 installed, I sometimes on the attempt to use tab completion continue to get an error/crash. I say sometimes because so far I have not figured what triggers or prevents it because some sessions it works and in others it doesn't.
Screen output:
(saxonche125) mh@LAPTOP-C329VRUD:~$ python
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from saxonche import *
>>> saxon_proc = PySaxonProcessor()
>>> saxon_proc.Fatal error: Must either be at a safepoint or in native mode
Current timestamp: 1720350145512
Printing Instructions (ip=0x00007feaffa14600):
0x00007feaffa145e0: 0x00 0x41 0xc7 0x87 0xfc 0x00 0x00 0x00 0xfe 0xfe 0xfe 0x7e 0x48 0x8b 0x7c 0x24
0x00007feaffa145f0: 0x20 0x48 0x8b 0x74 0x24 0x10 0x48 0x8b 0x54 0x24 0x18 0xe8 0x90 0xfc 0xff 0xff
0x00007feaffa14600: 0x90 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc
0x00007feaffa14610: 0x48 0x83 0xec 0x18 0x49 0x3b 0x67 0x08 0x0f 0x86 0x9f 0x00 0x00 0x00 0x48 0x8b
Top of stack (sp=0x00007fff5f1c3b90):
0x00007fff5f1c3b90: 0x0000000000000000 0x0000000000000001
0x00007fff5f1c3ba0: 0x00007feafdc9a268 0x00007feafd700000
0x00007fff5f1c3bb0: 0x00007feaffa58a91 0x00007feaffa5f5f4
0x00007fff5f1c3bc0: 0x00007fff5f1c3d00 0x00007feaffa58a91
0x00007fff5f1c3bd0: 0x00007fff5f1c3c28 0x00007feb02f903c0
0x00007fff5f1c3be0: 0x0000000100000000 0x00007feaff9b2782
0x00007fff5f1c3bf0: 0x7819c420788047b2 0x0000000000000002
0x00007fff5f1c3c00: 0x00007fff5f1c3cbc 0x0000000001131d80
0x00007fff5f1c3c10: 0x0000000000000001 0x00000000010b7cf0
0x00007fff5f1c3c20: 0x0000000000000000 0x00007feb0322fe30
0x00007fff5f1c3c30: 0x00007feb02f03140 0x00007feb02f9d680
0x00007fff5f1c3c40: 0x00007fff5f1c3cf0 0x00007feb02e4e3a7
0x00007fff5f1c3c50: 0x0000000001175230 0x00007feb02f03140
0x00007fff5f1c3c60: 0x0000000000b43b70 0x0000000000b43b70
0x00007fff5f1c3c70: 0x00007fff5f1c3cf0 0x0000000000000000
0x00007fff5f1c3c80: 0x00007feb0322fe30 0x00007feb02eb5ded
0x00007fff5f1c3c90: 0x0000000000b43b70 0x0000000000000000
0x00007fff5f1c3ca0: 0x00007fff5f1c3cf0 0x0000000000584eb8
0x00007fff5f1c3cb0: 0x0000000000551170 0x0000000000000001
0x00007fff5f1c3cc0: 0x00007fff5f1c3ce0 0x00007feb0322fe30
0x00007fff5f1c3cd0: 0x00007feb02f03140 0x00007fff5f1c3d48
0x00007fff5f1c3ce0: 0x0000000000000027 0x00007feb032a9ee0
0x00007fff5f1c3cf0: 0x00007fff5f1c3d30 0x0000000000584d38
0x00007fff5f1c3d00: 0x00007fff5f1c3d70 0x00000000005b2ca2
0x00007fff5f1c3d10: 0x0000000000b3acf0 0x00007feb036b8168
0x00007fff5f1c3d20: 0x0000000000000003 0x0000000000a3f8a0
0x00007fff5f1c3d30: 0x00007fff5f1c3d70 0x00000000005d2f24
0x00007fff5f1c3d40: 0x000000000000009b 0x0000000000a2de00
0x00007fff5f1c3d50: 0x0000000000ba5048 0x00007feb036b80a0
0x00007fff5f1c3d60: 0x0000000000ba5048 0x000000000110504c
0x00007fff5f1c3d70: 0x00007fff5f1c3ef0 0x00000000005d8b3e
0x00007fff5f1c3d80: 0x0000000100000000 0x0000000000000000
Top frame info:
TotalFrameSize in CodeInfoTable 48
Threads:
0x00007feaf8000b80 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Reference Handler" - 0x00007feafe7c5570, daemon, stack(0x00007feafcd01000,0x00007feafd500000)
VM thread locals for the failing thread 0x0000000001131d80:
0 (8 bytes): JNIThreadLocalEnvironment.jniFunctions = (bytes)
0x0000000001131d80: 0x0000000001193711
8 (8 bytes): StackOverflowCheckImpl.stackBoundaryTL = (Word) 1 (0x0000000000000001)
16 (4 bytes): Safepoint.safepointRequested = (int) 2147428937 (0x7fff2a49)
20 (4 bytes): StatusSupport.statusTL = (int) 1 (0x00000001)
24 (32 bytes): ThreadLocalAllocation.regularTLAB = (bytes)
0x0000000001131d98: 0x0000000000000000 0x0000000000000000
0x0000000001131da8: 0x0000000000000000 0x0000000000000000
56 (8 bytes): PlatformThreads.currentThread = (Object) java.lang.Thread (0x00007feafe7c54b8)
64 (8 bytes): JavaFrameAnchors.lastAnchor = (Word) 0 (0x0000000000000000)
72 (8 bytes): AccessControlContextStack = (Object) null
80 (8 bytes): ExceptionUnwind.currentException = (Object) null
88 (8 bytes): IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) java.util.SplittableRandom (0x00007feafd54a428)
96 (8 bytes): IsolatedCompileClient.currentClient = (Object) null
104 (8 bytes): IsolatedCompileContext.currentContext = (Object) null
112 (8 bytes): JNIObjectHandles.handles = (Object) com.oracle.svm.core.handles.ThreadLocalHandles (0x00007feafd501158)
120 (8 bytes): JNIThreadLocalPendingException.pendingException = (Object) null
128 (8 bytes): JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) null
136 (8 bytes): JNIThreadOwnedMonitors.ownedMonitors = (Object) null
144 (8 bytes): NoAllocationVerifier.openVerifiers = (Object) null
152 (8 bytes): ThreadingSupportImpl.activeTimer = (Object) null
160 (8 bytes): SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes)
0x0000000001131e20: 0x0000000000000000
168 (8 bytes): ThreadLocalAllocation.allocatedBytes = (Word) 300352 (0x0000000000049540)
176 (8 bytes): VMThreads.IsolateTL = (Word) 140647251050496 (0x00007feafd700000)
184 (8 bytes): VMThreads.OSThreadHandleTL = (Word) 140647347990656 (0x00007feb03373080)
192 (8 bytes): VMThreads.OSThreadIdTL = (Word) 140647347990656 (0x00007feb03373080)
200 (8 bytes): VMThreads.StackBase = (Word) 140734789095424 (0x00007fff5f1c9000)
208 (8 bytes): VMThreads.StackEnd = (Word) 140734780715008 (0x00007fff5e9cb000)
216 (8 bytes): VMThreads.StartedByCurrentIsolate = (bytes)
0x0000000001131e58: 0x0000000000000000
224 (8 bytes): VMThreads.nextTL = (Word) 18029952 (0x0000000001131d80)
232 (8 bytes): VMThreads.unalignedIsolateThreadMemoryTL = (Word) 18029952 (0x0000000001131d80)
240 (4 bytes): ActionOnExitSafepointSupport.actionTL = (int) 0 (0x00000000)
244 (4 bytes): ActionOnTransitionToJavaSupport.actionTL = (int) 0 (0x00000000)
248 (4 bytes): ImplicitExceptions.implicitExceptionsAreFatal = (int) 0 (0x00000000)
252 (4 bytes): StackOverflowCheckImpl.yellowZoneStateTL = (int) 2130640638 (0x7efefefe)
256 (4 bytes): StatusSupport.safepointBehaviorTL = (int) 1 (0x00000001)
260 (4 bytes): ThreadingSupportImpl.currentPauseDepth = (int) 0 (0x00000000)
No VMOperation in progress
The 15 most recent VM operation status changes (oldest first):
Counters:
Java frame anchors for the failing thread 0x0000000001131d80:
No anchors
Stacktrace for the failing thread 0x0000000001131d80:
SP 0x00007fff5f1c3b90 IP 0x00007feaffa14600 [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shutdown(VMErrorSubstitutions.java:116)
SP 0x00007fff5f1c3b90 IP 0x00007feaffa14600 [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shouldNotReachHere(VMErrorSubstitutions.java:109)
SP 0x00007fff5f1c3bc0 IP 0x00007feaffa5f5f4 [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:65)
SP 0x00007fff5f1c3bd0 IP 0x00007feaffa58a91 [image code] com.oracle.svm.core.util.VMError.guarantee(VMError.java:89)
SP 0x00007fff5f1c3bd0 IP 0x00007feaffa58a91 [image code] com.oracle.svm.core.thread.Safepoint.enterSlowPathTransitionFromNativeToNewStatus(Safepoint.java:547)
SP 0x00007fff5f1c3bf0 IP 0x00007feaff9b2782 [image code] com.oracle.svm.core.code.IsolateEnterStub.SaxonCAPI_getProductVersion_cfa0e13fc82d005b303f6bf24a96696cf9afd7c7(IsolateEnterStub.java:0)
VM mutexes:
mutex "mainVMOperationControlWorkQueue" is unlocked.
mutex "thread" is unlocked.
mutex "referencePendingList" is unlocked.
AOT compiled code is mapped at 0x00007feaff96e000 - 0x00007feb0129788f
Heap settings and statistics:
Supports isolates: true
Heap base: 0x00007feafd700000
Object reference size: 8
Aligned chunk size: 1048576
Incremental collections: 0
Complete collections: 0
Native image heap boundaries:
ReadOnly Primitives: 0x00007feafd801028 - 0x00007feafdc06978
ReadOnly References: 0x00007feafdc06978 - 0x00007feafdef16a8
ReadOnly Relocatables: 0x00007feafdef2000 - 0x00007feafe140cb0
Writable Primitives: 0x00007feafe141000 - 0x00007feafe6b6498
Writable References: 0x00007feafe6b6498 - 0x00007feafeb961a8
Writable Huge: 0x00007feafec00030 - 0x00007feafec73830
ReadOnly Huge: 0x00007feafec74030 - 0x00007feaff332b68
Heap:
Young generation:
Eden:
edenSpace:
aligned: 1048576/1 unaligned: 0/0
aligned chunks:
0x00007feafd500000 (0x00007feafd501028-0x00007feafd54a568)
Survivors:
Survivor-1 From:
aligned: 0/0 unaligned: 0/0
Survivor-1 To:
aligned: 0/0 unaligned: 0/0
Survivor-2 From:
aligned: 0/0 unaligned: 0/0
Survivor-2 To:
aligned: 0/0 unaligned: 0/0
Survivor-3 From:
aligned: 0/0 unaligned: 0/0
Survivor-3 To:
aligned: 0/0 unaligned: 0/0
Survivor-4 From:
aligned: 0/0 unaligned: 0/0
Survivor-4 To:
aligned: 0/0 unaligned: 0/0
Survivor-5 From:
aligned: 0/0 unaligned: 0/0
Survivor-5 To:
aligned: 0/0 unaligned: 0/0
Survivor-6 From:
aligned: 0/0 unaligned: 0/0
Survivor-6 To:
aligned: 0/0 unaligned: 0/0
Survivor-7 From:
aligned: 0/0 unaligned: 0/0
Survivor-7 To:
aligned: 0/0 unaligned: 0/0
Survivor-8 From:
aligned: 0/0 unaligned: 0/0
Survivor-8 To:
aligned: 0/0 unaligned: 0/0
Survivor-9 From:
aligned: 0/0 unaligned: 0/0
Survivor-9 To:
aligned: 0/0 unaligned: 0/0
Survivor-10 From:
aligned: 0/0 unaligned: 0/0
Survivor-10 To:
aligned: 0/0 unaligned: 0/0
Survivor-11 From:
aligned: 0/0 unaligned: 0/0
Survivor-11 To:
aligned: 0/0 unaligned: 0/0
Survivor-12 From:
aligned: 0/0 unaligned: 0/0
Survivor-12 To:
aligned: 0/0 unaligned: 0/0
Survivor-13 From:
aligned: 0/0 unaligned: 0/0
Survivor-13 To:
aligned: 0/0 unaligned: 0/0
Survivor-14 From:
aligned: 0/0 unaligned: 0/0
Survivor-14 To:
aligned: 0/0 unaligned: 0/0
Survivor-15 From:
aligned: 0/0 unaligned: 0/0
Survivor-15 To:
aligned: 0/0 unaligned: 0/0
Old generation:
oldFromSpace:
aligned: 0/0 unaligned: 0/0
oldToSpace:
aligned: 0/0 unaligned: 0/0
Unused:
aligned: 0/0
Fatal error: Must either be at a safepoint or in native mode
Updated by Martin Honnen 5 months ago
I am also with SaxonCHE 12.5 able to trigger the segmentation fault in the shell on a Mac:
martin@MacBook-Pro-von-Martin ~ % python3 -m pip install saxonche==12.5
Defaulting to user installation because normal site-packages is not writeable
Collecting saxonche==12.5
Downloading saxonche-12.5.0-cp39-cp39-macosx_11_0_arm64.whl.metadata (5.7 kB)
Downloading saxonche-12.5.0-cp39-cp39-macosx_11_0_arm64.whl (20.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 20.0/20.0 MB 6.3 MB/s eta 0:00:00
Installing collected packages: saxonche
Attempting uninstall: saxonche
Found existing installation: saxonche 12.4.2
Uninstalling saxonche-12.4.2:
Successfully uninstalled saxonche-12.4.2
Successfully installed saxonche-12.5.0
martin@MacBook-Pro-von-Martin ~ % python3
Python 3.9.6 (default, Mar 29 2024, 10:51:09)
[Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from saxonche import *
>>> saxon_proc = PySaxon
PySaxonApiError( PySaxonProcessor(
>>> saxon_proc = PySaxonProcessor()
>>> saxon_proc.zsh: segmentation fault python3
Error report has more details as
Process: Python [35693]
Path: /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
Identifier: com.apple.python3
Version: 3.9.6 (3.9.6)
Build Info: python3-141000000000000~1681
Code Type: ARM-64 (Native)
Parent Process: zsh [942]
Responsible: Terminal [655]
User ID: 501
Date/Time: 2024-07-07 15:22:55.2055 +0200
OS Version: macOS 14.5 (23F79)
Report Version: 12
Time Awake Since Boot: 96000 seconds
Time Since Wake: 393 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000597858
Exception Codes: 0x0000000000000001, 0x0000000000597858
Termination Reason: Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process: exc handler [35693]
VM Region Info: 0x597858 is not in any region. Bytes before following region: 4359817128
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
UNUSED SPACE AT START
--->
__TEXT 104370000-104374000 [ 16K] r-x/r-x SM=COW /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsaxon-hec-12.5.0.dylib 0x1087233a4 0x10865c000 + 816036
1 saxonche.cpython-39-darwin.so 0x10465a750 __pyx_getprop_8saxonche_16PySaxonProcessor_exception_occurred(_object*, void*) + 16
2 Python3 0x104dd86a0 _PyObject_GenericGetAttrWithDict + 196
3 Python3 0x104dd3188 0x104d50000 + 536968
4 Python3 0x104e62a38 0x104d50000 + 1124920
5 Python3 0x104e5fbf4 _PyEval_EvalFrameDefault + 22824
6 Python3 0x104d90fd0 0x104d50000 + 266192
7 Python3 0x104e62a38 0x104d50000 + 1124920
8 Python3 0x104e5fb54 _PyEval_EvalFrameDefault + 22664
9 Python3 0x104d90fd0 0x104d50000 + 266192
10 Python3 0x104d931f0 0x104d50000 + 274928
11 Python3 0x104d91574 0x104d50000 + 267636
12 Python3 0x104d913c4 PyObject_CallFunction + 52
13 readline.cpython-39-darwin.so 0x104536708 0x104530000 + 26376
14 libedit.3.dylib 0x1cffc320c rl_completion_matches + 60
15 readline.cpython-39-darwin.so 0x1045364e0 0x104530000 + 25824
16 libedit.3.dylib 0x1cffbb860 0x1cffb7000 + 18528
17 libedit.3.dylib 0x1cffc2974 rl_complete + 292
18 libedit.3.dylib 0x1cffc0308 0x1cffb7000 + 37640
19 libedit.3.dylib 0x1cffbfa9c el_wgets + 468
20 libedit.3.dylib 0x1cffcaf68 el_gets + 52
21 libedit.3.dylib 0x1cffc2d98 rl_callback_read_char + 44
22 readline.cpython-39-darwin.so 0x104535050 0x104530000 + 20560
23 Python3 0x104d71490 PyOS_Readline + 228
24 Python3 0x104d747a0 0x104d50000 + 149408
25 Python3 0x104d72bc8 0x104d50000 + 142280
26 Python3 0x104d72b20 0x104d50000 + 142112
27 Python3 0x104d5716c 0x104d50000 + 29036
28 Python3 0x104d5b19c 0x104d50000 + 45468
29 Python3 0x104d58028 0x104d50000 + 32808
30 Python3 0x104d582cc 0x104d50000 + 33484
31 Python3 0x104e9c988 0x104d50000 + 1362312
32 Python3 0x104e9c160 PyRun_InteractiveLoopFlags + 156
33 Python3 0x104e9c080 PyRun_AnyFileExFlags + 72
34 Python3 0x104eb9ac0 Py_RunMain + 2360
35 Python3 0x104eb9c3c 0x104d50000 + 1481788
36 Python3 0x104eb9cdc Py_BytesMain + 40
37 dyld 0x1853460e0 start + 2360
Thread 1:: ference Handler
0 libsystem_kernel.dylib 0x1856919ec __psynch_cvwait + 8
1 libsystem_pthread.dylib 0x1856cf55c _pthread_cond_wait + 1228
2 libsaxon-hec-12.5.0.dylib 0x10872f194 0x10865c000 + 864660
3 libsystem_pthread.dylib 0x1856c9d34 thread_start + 8
Thread 0 crashed with ARM Thread State (64-bit):
x0: 0x00000000013b1820 x1: 0x0000000000597858 x2: 0x0000000000000000 x3: 0x000000000000000b
x4: 0x000000016ba8d520 x5: 0x00000000013b1820 x6: 0x0000000000597858 x7: 0x0000000000000000
x8: 0x0000000121704180 x9: 0x0000000000000002 x10: 0x0000000000000018 x11: 0x00000000000000da
x12: 0x000000010456fc58 x13: 0x0000000000000000 x14: 0x0000000000000018 x15: 0x000000000000000a
x16: 0x00000001086a9880 x17: 0x0000000000000000 x18: 0x0000000000000000 x19: 0x00000001044e8580
x20: 0x00000001044e5e40 x21: 0x0000000000000000 x22: 0x00000001044e6490 x23: 0x00000001046c3750
x24: 0x0000000000000002 x25: 0x0000000000000000 x26: 0x0000000104d98bb0 x27: 0x0000000000000000
x28: 0x0000000121704080 fp: 0x000000016ba8d860 lr: 0x0000000108703cc0
sp: 0x000000016ba8d4f0 pc: 0x00000001087233a4 cpsr: 0x20001000
far: 0x0000000000597858 esr: 0x92000006 (Data Abort) byte read Translation fault
Binary Images:
0x1045c8000 - 0x1045cffff _heapq.cpython-39-darwin.so (*) <b7834f0f-6879-32e9-86dc-214fe45b58bd> /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/lib-dynload/_heapq.cpython-39-darwin.so
0x104628000 - 0x1046a7fff saxonche.cpython-39-darwin.so (*) <d755935d-cf9a-3126-a4c4-2ec28652eaef> /Users/USER/Library/Python/3.9/lib/python/site-packages/saxonche.cpython-39-darwin.so
0x10865c000 - 0x10a0a3fff libsaxon-hec-12.5.0.dylib (*) <c4a216c9-8bb8-35a9-98f3-28833b4e6155> /Users/USER/Library/Python/3.9/lib/python/site-packages/saxonche.dylibs/libsaxon-hec-12.5.0.dylib
0x104530000 - 0x104537fff readline.cpython-39-darwin.so (*) <5eb4dd87-2b43-3aac-a790-2e7495e2b13b> /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/lib-dynload/readline.cpython-39-darwin.so
0x104d50000 - 0x104fabfff com.apple.python3 (3.9.6) <e9e1d956-52be-3c08-942d-a2ee518130a3> /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Python3
0x104370000 - 0x104373fff com.apple.python3 (3.9.6) <a325eb77-7b03-3888-9ec1-5c4f09be1ee1> /Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Resources/Python.app/Contents/MacOS/Python
0x1cffb7000 - 0x1cffd4fff libedit.3.dylib (*) <8fcb95a4-aa04-3875-974a-57d69834e151> /usr/lib/libedit.3.dylib
0x185340000 - 0x1853c8a17 dyld (*) <37bbc384-0755-31c7-a808-0ed49e44dd8e> /usr/lib/dyld
0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
0x18568d000 - 0x1856c7ffb libsystem_kernel.dylib (*) <9b8b53f9-e2b6-36df-98e9-28d8fca732f2> /usr/lib/system/libsystem_kernel.dylib
0x1856c8000 - 0x1856d4fff libsystem_pthread.dylib (*) <386b0fc1-7873-3328-8e71-43269fd1b2c7> /usr/lib/system/libsystem_pthread.dylib
External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
VM Region Summary:
ReadOnly portion of Libraries: Total=686.3M resident=0K(0%) swapped_out_or_unallocated=686.3M(100%)
Writable regions: Total=954.1M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=954.1M(100%)
VIRTUAL REGION
REGION TYPE SIZE COUNT (non-coalesced)
=========== ======= =======
Kernel Alloc Once 32K 1
MALLOC 933.2M 21
MALLOC guard page 96K 6
STACK GUARD 32K 2
Stack 16.5M 2
VM_ALLOCATE 5376K 12
__AUTH 343K 69
__AUTH_CONST 4089K 150
__DATA 29.5M 151
__DATA_CONST 4290K 157
__DATA_DIRTY 365K 58
__LINKEDIT 534.0M 7
__OBJC_RO 71.9M 1
__OBJC_RW 2199K 1
__TEXT 152.3M 164
dyld private memory 272K 1
mapped file 27.2M 3
shared memory 32K 2
=========== ======= =======
TOTAL 1.7G 808
Updated by Matt Patterson 5 months ago
- Status changed from Rejected to In Progress
Updated by Matt Patterson 5 months ago
- Status changed from In Progress to AwaitingInfo
- SaxonC Architecture deleted (
x86_64) - SaxonC Platforms Linux added
Reading around it seems like Readline causing segfaults in the REPL is a thing that has happened outside SaxonC in the past, with the culprits being versions of Readline Python was compiled against not quite matching with installed versions, or versions being too old.
I haven't yet managed to persuade SaxonC to segfault in the REPL, which makes me wonder if there's a version/installation method trigger.
If anyone is able to reliably make their REPL segfault, could you please make a screen recording of a terminal session where you trigger it? I think that there's probably a whole lot of timing / exact steps stuff that's very hard to communicate in a screenshot or pasting text from the terminal. (Something like https://asciinema.org should also work here.)
If you can trigger it at all (reliably or not), can you let me know exactly what Python you're using, your OS, how you installed Python, and probably the terminal and shell you're using (I'm not sure how these all affect Readline, but I'm pretty sure they do).
Leaving these here as pointers for later: https://community.intel.com/t5/Intel-Distribution-for-Python/Segmentation-fault-on-tab-completion/m-p/1456128 https://github.com/ludwigschwardt/python-readline/issues/1
Updated by Martin Honnen 5 months ago
Hi Matt,
I agree it will be hard to identify the relevant configurations.
But I get some error at some point with Python 3.12.3 under Ubuntu 24.04 Linux run under WSL, shell is bash. Saxon installed with pip install after creating a venv with python3 -m venv and activating that.
I will attach a screen recording.
I also thought I could reproduce it on Windows but some, since I started to try to record it, it seems a Heisenbug and doesn't manifest itself.
Updated by Martin Honnen 5 months ago
- File Bildschirmaufnahme 2024-07-08 um 12.54.55.mov Bildschirmaufnahme 2024-07-08 um 12.54.55.mov added
I also got a segmentation fault on my MacBook Pro M3 with Python 3.9.6:
martin@MacBook-Pro-von-Martin ~ % python3 -m pip list
Package Version
---------- -------
altgraph 0.17.2
future 0.18.2
macholib 1.15.2
pip 24.1.1
saxonche 12.5.0
setuptools 58.0.4
six 1.15.0
wheel 0.37.0
martin@MacBook-Pro-von-Martin ~ % python3
Python 3.9.6 (default, Mar 29 2024, 10:51:09)
[Clang 15.0.0 (clang-1500.3.9.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from saxonche import *
>>> saxon_proc = PySaxonProcessor()
>>> saxon_proc.zsh: segmentation fault python3
I will attach a recording
Updated by Martin Honnen 5 months ago
Now managed to record a crash with Windows 11 cmd shell and Python 3.12 and SaxonCHE 12.5 installed with pip.
C:\Users\marti>python
Python 3.12.4 (tags/v3.12.4:8e8a4ba, Jun 6 2024, 19:30:16) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from saxonche import *
>>> saxon_proc = PySaxonProcessor()
>>> saxon_proc.Fatal error: Must either be at a safepoint or in native mode
Current timestamp: 1720438522267
Printing Instructions (ip=0x00007ff8c2882e40):
0x00007ff8c2882e20: 0x00 0x41 0xc7 0x87 0xfc 0x00 0x00 0x00 0xfe 0xfe 0xfe 0x7e 0x48 0x8b 0x54 0x24
0x00007ff8c2882e30: 0x20 0x4c 0x8b 0x44 0x24 0x10 0x4c 0x8b 0x4c 0x24 0x18 0xe8 0x80 0xfc 0xff 0xff
0x00007ff8c2882e40: 0x90 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc
0x00007ff8c2882e50: 0x48 0x83 0xec 0x28 0x48 0x89 0x54 0x24 0x20 0x49 0x3b 0x67 0x08 0x0f 0x86 0x66
Top of stack (sp=0x0000008ef93ea880):
0x0000008ef93ea880: 0x0000025de06a2b38 0x00007ff8c28d5e7e
0x0000008ef93ea890: 0x0000025ddf79a9c8 0x0000025ddf200000
0x0000008ef93ea8a0: 0x00007ff8c28d2aa7 0x00007ff8c28d9a14
0x0000008ef93ea8b0: 0x0000025de0491068 0x00007ff8c28d2aa7
0x0000008ef93ea8c0: 0x00007ffa15cd2658 0x00007ffa7b50d5e8
0x0000008ef93ea8d0: 0x0000000100000000 0x00007ff8c281ce1d
0x0000008ef93ea8e0: 0x0000025ddc515bd0 0x0000025ddc515bd0
0x0000008ef93ea8f0: 0x00007ff900000003 0x0000025ddcb4ee80
0x0000008ef93ea900: 0x0000000000000000 0x0000000000000000
0x0000008ef93ea910: 0x0000000000000000 0x0000000000000000
0x0000008ef93ea920: 0xc1e0000000000000 0x0000000000000000
0x0000008ef93ea930: 0x7ff0000000000000 0x0000000000000000
0x0000008ef93ea940: 0x7fffffffffffffff 0x0000000000000000
0x0000008ef93ea950: 0x41e0000000000000 0x0000000000000000
0x0000008ef93ea960: 0x8000000000000000 0x0000000000000000
0x0000008ef93ea970: 0xbff0000000000000 0x0000000000000000
0x0000008ef93ea980: 0x0000000000000000 0x0000000000000000
0x0000008ef93ea990: 0x0000000000000000 0x0000000000000000
0x0000008ef93ea9a0: 0x00007ff9220df018 0x00007ffa15cfcbe0
0x0000008ef93ea9b0: 0x0000000000000000 0x0000025ddcb74270
0x0000008ef93ea9c0: 0x00007ff922081768 0x00007ff921acbc8c
0x0000008ef93ea9d0: 0x0000025ddf0cd4f0 0x0000000000000000
0x0000008ef93ea9e0: 0x0000025ddf0cd4c0 0x00007ffa15cc17e5
0x0000008ef93ea9f0: 0x0000025ddc630658 0x0000025ddcad7280
0x0000008ef93eaa00: 0x0000025ddf0cd4c0 0x00007ff921f46a30
0x0000008ef93eaa10: 0x0000000000000000 0x00007ff921aca19b
0x0000008ef93eaa20: 0x00007ff922081768 0x00007ffa15cfcbe0
0x0000008ef93eaa30: 0x0000008ef93eaab8 0x00007ff900000001
0x0000008ef93eaa40: 0x0000025ddf0cd4c0 0x00007ff921ac9585
0x0000008ef93eaa50: 0x00007ffa15cfcbe0 0x00007ff921f46890
0x0000008ef93eaa60: 0x00007ff9220df018 0x0000025ddc630670
0x0000008ef93eaa70: 0x0000025ddf0cd4f0 0x0000025ddc630580
Top frame info:
TotalFrameSize in CodeInfoTable 48
Threads:
0x0000025ddc5f7cc0 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Reference Handler" - 0x0000025de02cc6c8, daemon, stack(0x0000008ef99c0000,0x0000008ef9bb0000)
VM thread locals for the failing thread 0x0000025ddcb4ee80:
0 (8 bytes): JNIThreadLocalEnvironment.jniFunctions = (bytes)
0x0000025ddcb4ee80: 0x0000025ddf9f4010
8 (8 bytes): StackOverflowCheckImpl.stackBoundaryTL = (Word) 1 (0x0000000000000001)
16 (4 bytes): Safepoint.safepointRequested = (int) 2147391330 (0x7ffe9762)
20 (4 bytes): StatusSupport.statusTL = (int) 1 (0x00000001)
24 (32 bytes): ThreadLocalAllocation.regularTLAB = (bytes)
0x0000025ddcb4ee98: 0x0000000000000000 0x0000000000000000
0x0000025ddcb4eea8: 0x0000000000000000 0x0000000000000000
56 (8 bytes): PlatformThreads.currentThread = (Object) java.lang.Thread (0x0000025de02cc618)
64 (8 bytes): JavaFrameAnchors.lastAnchor = (Word) 0 (0x0000000000000000)
72 (8 bytes): AccessControlContextStack = (Object) java.util.ArrayDeque (0x0000025de0e32f60)
80 (8 bytes): ExceptionUnwind.currentException = (Object) null
88 (8 bytes): IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) java.util.SplittableRandom (0x0000025de0e988a8)
96 (8 bytes): IsolatedCompileClient.currentClient = (Object) null
104 (8 bytes): IsolatedCompileContext.currentContext = (Object) null
112 (8 bytes): JNIObjectHandles.handles = (Object) com.oracle.svm.core.handles.ThreadLocalHandles (0x0000025de0e01158)
120 (8 bytes): JNIThreadLocalPendingException.pendingException = (Object) null
128 (8 bytes): JNIThreadLocalPinnedObjects.pinnedObjectsListHead = (Object) null
136 (8 bytes): JNIThreadOwnedMonitors.ownedMonitors = (Object) null
144 (8 bytes): NoAllocationVerifier.openVerifiers = (Object) null
152 (8 bytes): ThreadingSupportImpl.activeTimer = (Object) null
160 (8 bytes): SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes)
0x0000025ddcb4ef20: 0x0000000000000000
168 (8 bytes): ThreadLocalAllocation.allocatedBytes = (Word) 620992 (0x00000000000979c0)
176 (8 bytes): VMThreads.IsolateTL = (Word) 2602198630400 (0x0000025ddf200000)
184 (8 bytes): VMThreads.OSThreadHandleTL = (Word) 936 (0x00000000000003a8)
192 (8 bytes): VMThreads.OSThreadIdTL = (Word) 138548 (0x0000000000021d34)
200 (8 bytes): VMThreads.StackBase = (Word) 614067011584 (0x0000008ef93f0000)
208 (8 bytes): VMThreads.StackEnd = (Word) 614064979968 (0x0000008ef9200000)
216 (8 bytes): VMThreads.StartedByCurrentIsolate = (bytes)
0x0000025ddcb4ef58: 0x0000000000000000
224 (8 bytes): VMThreads.nextTL = (Word) 2602158059136 (0x0000025ddcb4ee80)
232 (8 bytes): VMThreads.unalignedIsolateThreadMemoryTL = (Word) 2602158059120 (0x0000025ddcb4ee70)
240 (4 bytes): ActionOnExitSafepointSupport.actionTL = (int) 0 (0x00000000)
244 (4 bytes): ActionOnTransitionToJavaSupport.actionTL = (int) 0 (0x00000000)
248 (4 bytes): ImplicitExceptions.implicitExceptionsAreFatal = (int) 0 (0x00000000)
252 (4 bytes): StackOverflowCheckImpl.yellowZoneStateTL = (int) 2130640638 (0x7efefefe)
256 (4 bytes): StatusSupport.safepointBehaviorTL = (int) 1 (0x00000001)
260 (4 bytes): ThreadingSupportImpl.currentPauseDepth = (int) 0 (0x00000000)
No VMOperation in progress
The 15 most recent VM operation status changes (oldest first):
Counters:
Java frame anchors for the failing thread 0x0000025ddcb4ee80:
No anchors
Stacktrace for the failing thread 0x0000025ddcb4ee80:
SP 0x0000008ef93ea880 IP 0x00007ff8c2882e40 [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shutdown(VMErrorSubstitutions.java:116)
SP 0x0000008ef93ea880 IP 0x00007ff8c2882e40 [image code] com.oracle.svm.core.jdk.VMErrorSubstitutions.shouldNotReachHere(VMErrorSubstitutions.java:109)
SP 0x0000008ef93ea8b0 IP 0x00007ff8c28d9a14 [image code] com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:65)
SP 0x0000008ef93ea8c0 IP 0x00007ff8c28d2aa7 [image code] com.oracle.svm.core.util.VMError.guarantee(VMError.java:89)
SP 0x0000008ef93ea8c0 IP 0x00007ff8c28d2aa7 [image code] com.oracle.svm.core.thread.Safepoint.enterSlowPathTransitionFromNativeToNewStatus(Safepoint.java:547)
SP 0x0000008ef93ea8e0 IP 0x00007ff8c281ce1d [image code] com.oracle.svm.core.code.IsolateEnterStub.SaxonCException_checkForException_98a6e5b9c0cdad1387477917fdcfde8ca66fc74a(IsolateEnterStub.java:0)
VM mutexes:
mutex "thread" is unlocked.
mutex "mainVMOperationControlWorkQueue" is unlocked.
mutex "referencePendingList" is unlocked.
AOT compiled code is mapped at 0x00007ff8c27c1000 - 0x00007ff8c4164a2f
Heap settings and statistics:
Supports isolates: true
Heap base: 0x0000025ddf200000
Object reference size: 8
Aligned chunk size: 1048576
Incremental collections: 0
Complete collections: 0
Native image heap boundaries:
ReadOnly Primitives: 0x0000025ddf301028 - 0x0000025ddf709760
ReadOnly References: 0x0000025ddf709760 - 0x0000025ddf9f3248
ReadOnly Relocatables: 0x0000025ddf9f4000 - 0x0000025ddfc41d50
Writable Primitives: 0x0000025ddfc42000 - 0x0000025de01bb2b0
Writable References: 0x0000025de01bb2b0 - 0x0000025de06a7830
Writable Huge: 0x0000025de0700030 - 0x0000025de0773af0
ReadOnly Huge: 0x0000025de0774030 - 0x0000025de0d96e08
Heap:
Young generation:
Eden:
edenSpace:
aligned: 1048576/1 unaligned: 0/0
aligned chunks:
0x0000025de0e00000 (0x0000025de0e01028-0x0000025de0e989e8)
Survivors:
Survivor-1 From:
aligned: 0/0 unaligned: 0/0
Survivor-1 To:
aligned: 0/0 unaligned: 0/0
Survivor-2 From:
aligned: 0/0 unaligned: 0/0
Survivor-2 To:
aligned: 0/0 unaligned: 0/0
Survivor-3 From:
aligned: 0/0 unaligned: 0/0
Survivor-3 To:
aligned: 0/0 unaligned: 0/0
Survivor-4 From:
aligned: 0/0 unaligned: 0/0
Survivor-4 To:
aligned: 0/0 unaligned: 0/0
Survivor-5 From:
aligned: 0/0 unaligned: 0/0
Survivor-5 To:
aligned: 0/0 unaligned: 0/0
Survivor-6 From:
aligned: 0/0 unaligned: 0/0
Survivor-6 To:
aligned: 0/0 unaligned: 0/0
Survivor-7 From:
aligned: 0/0 unaligned: 0/0
Survivor-7 To:
aligned: 0/0 unaligned: 0/0
Survivor-8 From:
aligned: 0/0 unaligned: 0/0
Survivor-8 To:
aligned: 0/0 unaligned: 0/0
Survivor-9 From:
aligned: 0/0 unaligned: 0/0
Survivor-9 To:
aligned: 0/0 unaligned: 0/0
Survivor-10 From:
aligned: 0/0 unaligned: 0/0
Survivor-10 To:
aligned: 0/0 unaligned: 0/0
Survivor-11 From:
aligned: 0/0 unaligned: 0/0
Survivor-11 To:
aligned: 0/0 unaligned: 0/0
Survivor-12 From:
aligned: 0/0 unaligned: 0/0
Survivor-12 To:
aligned: 0/0 unaligned: 0/0
Survivor-13 From:
aligned: 0/0 unaligned: 0/0
Survivor-13 To:
aligned: 0/0 unaligned: 0/0
Survivor-14 From:
aligned: 0/0 unaligned: 0/0
Survivor-14 To:
aligned: 0/0 unaligned: 0/0
Survivor-15 From:
aligned: 0/0 unaligned: 0/0
Survivor-15 To:
aligned: 0/0 unaligned: 0/0
Old generation:
oldFromSpace:
aligned: 0/0 unaligned: 0/0
oldToSpace:
aligned: 0/0 unaligned: 0/0
Unused:
aligned: 0/0
Fatal error: Must either be at a safepoint or in native mode
Screen recording added.
Updated by Matt Patterson 5 months ago
- Status changed from AwaitingInfo to In Progress
Thanks, Martin.
I can reproduce it with saxonche
too, after following your example.
Updated by Matt Patterson 5 months ago
- Fix Committed on Branch 12 added
- SaxonC Languages C++ added
- SaxonC Platforms All added
- SaxonC Platforms deleted (
Linux, macOS)
We managed to reproduce the report and find some places where we were incorrectly managing C++ resources, and fixing that stopped those segfaults from occuring.
We need to do some more testing to ensure we've fixed all the problems with incorrect resource handling.
Please register to edit this issue