Repository navigation
Conversation
Diagnostic-only change to capture a native backtrace for the intermittent hxSehException crash of the cppia JIT on macOS arm64, which happens while the unit test module is being JIT-compiled (Host.hx line 45). - Run the cppia JIT unit test up to 30 times under lldb on macOS arm64, dumping backtraces, registers and disassembly when it crashes. - Disable all other CI jobs so only mac-test (cppia, arm64) runs. Not intended to be merged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Va4FXG8Zex7iQytzPnDKyg
The crash did not reproduce in 30 runs under lldb, which disables ASLR by default, while the following plain run crashed immediately. Re-enable ASLR and print the first run's lldb output to confirm the setting is applied. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Va4FXG8Zex7iQytzPnDKyg
The crash was caught in ScriptCallable::compile at CppiaFunction.cpp:662 with body == 0x500000000, which looks like a use-after-free or an overwrite. Run a few times with Guard Malloc first to make the bad access fault where it happens, then loop with MallocScribble and stack logging, and dump the ScriptCallable/CppiaFunction and its malloc history on crash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Va4FXG8Zex7iQytzPnDKyg
Member
|
Interesting 👀 We might also be able to get some information here about which part is being compiled when the error happens: https://github.com/HaxeFoundation/hxcpp/blame/c9892dc11b0a7ab1f5960f656faea89222c2d682/src/hx/cppia/Cppia.h#L47 |
The cppia generator emitted a bare RETURN expression as the body of an abstract method. hxcpp reads every class method as a ScriptCallable, and when JIT compiling it calls the non-virtual ScriptCallable::compile on it, which reads past the end of the much smaller RetVal object. Depending on the heap layout, this crashed while loading the module (seen on macOS arm64 with Issue11666's abstract Foo.foo). Reuse the no-op tfunc that the C++ generator already builds for abstract methods, so cppia gets a proper FUN with the right args and defaults. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Va4FXG8Zex7iQytzPnDKyg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Va4FXG8Zex7iQytzPnDKyg
Member
Author
|
Closing this debugging PR. Guard Malloc found the root cause (abstract methods emitted as a bare Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Diagnostic-only PR, not meant to be merged. It tries to get a native backtrace for the intermittent
mac-test (cpp, arm64)failures.Background
About 1 in 3
mac-test (cpp, arm64)jobs fail. Every failure shows the same thing: the interpretedHost-debug bin/unit.cppiarun passes, then the-jitrun dies with:Host.hx:45isModule.fromData(...), so the crash happens while the module is being JIT-compiled (CppiaModule::compile), before any script code runs.hxSehExceptionis hxcpp'sHXCPP_CATCH_SEGVhandler converting a SIGSEGV. The failures predate the hxcpp sljit upgrade (HaxeFoundation/hxcpp#1434) and only show up on macOS arm64.Changes
tests/runci/targets/Cpp.hx: on macOS arm64, run the unit cppia JIT up to 30 times underlldb --batchbefore the normal cppia runs. lldb stops on theEXC_BAD_ACCESSbefore hxcpp's handler sees it. On a crash the job prints all thread backtraces, registers, the symbol at$pc, disassembly and the loaded images, then fails..github/workflows/main.yml: disable the Windows and Linux builds, which skips all of their dependent jobs. Reducemac-testtocppiaon arm64 only. RunDevToolsSecurity -enableso lldb can attach. The macOS x86_64 build still runs because the universal binary needs it.Generated by Claude Code