-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGSEGV
in clang::cxcursor::CursorVisitor::Visit(CXCursor, bool)
#1437
Comments
Please try to set the "org.bytedeco.javacpp.nopointergc" system property to "true". |
Did you set the |
@saudet, thank you for the hints.
Setting |
Since the same issue also occurs on Windows, I tried to analyze the Similarly, the segmentation fault occurs at the This dump file has an exception of interest stored in it.
The stored exception information can be accessed via .ecxr.
(32868.337ac): Access violation - code c0000005 (first/second chance not available)
For analysis of this file, run !analyze -v
ntdll!NtGetContextThread+0x14:
00007ffc`f51cee34 c3 ret Running *******************************************************************************
* *
* Exception Analysis *
* *
*******************************************************************************
*** WARNING: Unable to verify checksum for jniclang.dll
KEY_VALUES_STRING: 1
Key : AV.Fault
Value: Execute
Key : Analysis.CPU.mSec
Value: 905
Key : Analysis.Elapsed.mSec
Value: 79916
Key : Analysis.IO.Other.Mb
Value: 4
Key : Analysis.IO.Read.Mb
Value: 17
Key : Analysis.IO.Write.Mb
Value: 34
Key : Analysis.Init.CPU.mSec
Value: 311
Key : Analysis.Init.Elapsed.mSec
Value: 20867
Key : Analysis.Memory.CommitPeak.Mb
Value: 91
Key : Failure.Bucket
Value: SOFTWARE_NX_FAULT_c0000005_libclang.dll!Unknown
Key : Failure.Hash
Value: {58c64d95-3ee2-2504-9cfe-4b7ff0ac9dd8}
Key : Timeline.OS.Boot.DeltaSec
Value: 1122330
Key : Timeline.Process.Start.DeltaSec
Value: 44
Key : WER.OS.Branch
Value: vb_release
Key : WER.OS.Version
Value: 10.0.19041.1
Key : WER.Process.Version
Value: 17.0.3.1
FILE_IN_CAB: hs_err_pid206952.mdmp
NTGLOBALFLAG: 0
PROCESS_BAM_CURRENT_THROTTLED: 0
PROCESS_BAM_PREVIOUS_THROTTLED: 0
APPLICATION_VERIFIER_FLAGS: 0
CONTEXT: (.ecxr)
rax=0000000000000000 rbx=0000005f14efd7f0 rcx=0000005f14efd770
rdx=0000005f14efd750 rsi=0000000000000001 rdi=0000005f14efd940
rip=0000000000000000 rsp=0000005f14efd728 rbp=0000000000000000
r8=000001861d9201a0 r9=0000000000000004 r10=00007ffc91b849e0
r11=00000000000000a2 r12=0000000000000000 r13=0000005f14efdb30
r14=0000005f14efd940 r15=0000000000000001
iopl=0 nv up ei pl zr na po nc
cs=0033 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00010246
00000000`00000000 ?? ???
Resetting default scope
EXCEPTION_RECORD: (.exr -1)
ExceptionAddress: 0000000000000000
ExceptionCode: c0000005 (Access violation)
ExceptionFlags: 00000000
NumberParameters: 2
Parameter[0]: 0000000000000008
Parameter[1]: 0000000000000000
Attempt to execute non-executable address 0000000000000000
PROCESS_NAME: java.exe
EXECUTE_ADDRESS: 0
FAILED_INSTRUCTION_ADDRESS:
+0
ERROR_CODE: (NTSTATUS) 0xc0000005 - The instruction at 0x%p referenced memory at 0x%p. The memory could not be %s.
EXCEPTION_CODE_STR: c0000005
EXCEPTION_PARAMETER1: 0000000000000008
EXCEPTION_PARAMETER2: 0000000000000000
STACK_TEXT:
0000005f`14efd728 00007ffc`7448985f : 00000186`7f7f2080 0000005f`14efd780 00000186`11304c10 0000005f`14efd840 : 0x0
0000005f`14efd730 00007ffc`74494428 : 0000005f`14efd908 0000005f`14efd810 0000005f`14efd940 00000000`00000000 : libclang!clang_getBuildSessionTimestamp+0xabef
0000005f`14efd7a0 00007ffc`7448a0ef : 0000005f`14efd8a0 00000186`255f0140 0000005f`14efd899 00000186`1d8698c0 : libclang!clang_defaultReparseOptions+0x59e8
0000005f`14efd820 00007ffc`744a4685 : 00000000`00000000 00000186`11304c10 00000001`00000000 00000000`00000000 : libclang!clang_getBuildSessionTimestamp+0xb47f
0000005f`14efd900 00007ffc`735b9cec : 00000006`0a309038 00000186`11304eb8 00000000`00000000 00000186`15e8cfd0 : libclang!clang_visitChildren+0xe5
0000005f`14efda50 00000186`720f8fc7 : 00000006`0a309038 00000186`14a14c30 0000005f`14efdb10 00000006`0a309010 : jniclang!Java_org_bytedeco_llvm_global_clang_clang_1visitChildren+0x10c
0000005f`14efdaa0 00000006`0a309038 : 00000186`14a14c30 0000005f`14efdb10 00000006`0a309010 0000005f`14efdad8 : 0x00000186`720f8fc7
0000005f`14efdaa8 00000186`14a14c30 : 0000005f`14efdb10 00000006`0a309010 0000005f`14efdad8 00000006`072680f8 : 0x00000006`0a309038
0000005f`14efdab0 0000005f`14efdb10 : 00000006`0a309010 0000005f`14efdad8 00000006`072680f8 00000006`072680b0 : 0x00000186`14a14c30
0000005f`14efdab8 00000006`0a309010 : 0000005f`14efdad8 00000006`072680f8 00000006`072680b0 00000006`07268080 : 0x0000005f`14efdb10
0000005f`14efdac0 0000005f`14efdad8 : 00000006`072680f8 00000006`072680b0 00000006`07268080 00000000`00000000 : 0x00000006`0a309010
0000005f`14efdac8 00000006`072680f8 : 00000006`072680b0 00000006`07268080 00000000`00000000 00000006`03c057b0 : 0x0000005f`14efdad8
0000005f`14efdad0 00000006`072680b0 : 00000006`07268080 00000000`00000000 00000006`03c057b0 00000186`142a18e0 : 0x00000006`072680f8
0000005f`14efdad8 00000006`07268080 : 00000000`00000000 00000006`03c057b0 00000186`142a18e0 00000006`04899c00 : 0x00000006`072680b0
0000005f`14efdae0 00000000`00000000 : 00000006`03c057b0 00000186`142a18e0 00000006`04899c00 0000005f`14efdb18 : 0x00000006`07268080
SYMBOL_NAME: libclang+abef
MODULE_NAME: libclang
IMAGE_NAME: libclang.dll
STACK_COMMAND: ~43s; .ecxr ; kb
FAILURE_BUCKET_ID: SOFTWARE_NX_FAULT_c0000005_libclang.dll!Unknown
OS_VERSION: 10.0.19041.1
BUILDLAB_STR: vb_release
OSPLATFORM_TYPE: x64
OSNAME: Windows 10
IMAGE_VERSION: 16.0.4.0
FAILURE_ID_HASH: {58c64d95-3ee2-2504-9cfe-4b7ff0ac9dd8}
Followup: MachineOwner
--------- |
@saudet, I found out that I'll try to create a minimal reproducer. If I'm successful in doing so, I'll share it here. |
Right, I don't think libclang is thread safe, that sounds normal.
|
It should be thread-safe, actually, despite I haven't found any official proof yet. But, citing this message:
Yet, other people have encountered the same problem as I. So I'll look further into this and get back to you. |
Hey! I just found this discussion when I encountered pretty much the same issue:
Due to that behavior, my suspicion is a pointer issue in clang, but that's just a very vague gut feeling. |
If it works LIBCLANG_DISABLE_CRASH_RECOVERY=1 then that's expected, yes: |
I'm calling
org.bytedeco.llvm.global.clang.clang_visitChildren(CXCursor, CXCursorVisitor, CXClientData)
from my Java code, and, while this works when parsing small C++ codebases, I'm repeatedly getting aSIGSEGV
when it comes to larger C++ codebases like that of CMake.The behaviour is the same regardless of Java version (11 or 17) or whether it's Windows or Linux — the JVM crashes with
SIGSEGV
/EXCEPTION_ACCESS_VIOLATION
:The problematic frame is
This frame corresponds to the
clang::cxcursor::CursorVisitor::Visit(CXCursor, bool)
function declared inCursorVisitor.h
and implemented inCIndex.cpp
.If we look at the output of
nm
(when executed against~/.javacpp/cache/llvm-16.0.4-1.5.9-linux-x86_64.jar/org/bytedeco/llvm/linux-x86_64/libclang.so.16
), the address of bothclang::cxcursor::CursorVisitor::Visit(CXCursor, bool)
andclang::cxcursor::CursorVisitor::Visit(CXCursor, bool) [clone .localalias]
is the same:If we debug the
core
withgdb
, the problematic frame will indeed be at offset0x523ac0
(which is exactly0x523a50
+0x70
):Here's the disassembly of the function body:
How can I further diagnose the issue?
The text was updated successfully, but these errors were encountered: