Repository navigation
Conversation
Author
|
not ready for review, just having a clanker try and port the code over - I haven't reviewed it myself yet. |
This was referenced Jul 15, 2026
dalehamel
force-pushed
the
dale/luajit-tarantool-parca
branch
from
July 15, 2026 02:16
a57138b to
1cc9153
Compare
dalehamel
marked this pull request as ready for review
July 15, 2026 02:25
dalehamel
marked this pull request as draft
July 15, 2026 02:26
dalehamel
marked this pull request as ready for review
July 16, 2026 20:11
Merged
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
dalehamel
force-pushed
the
dale/luajit-tarantool-parca
branch
from
August 14, 2026 13:49
b7d5699 to
39dd4c5
Compare
Tarantool embeds LuaJIT in its main executable rather than mapping a separate libluajit-5.1.so. Allow the tarantool binary through the loader's host-name gate so the existing symbol and offset extraction can probe it. Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Large statically linked binaries can contain an unrelated stack-delta gap that matches the interpreter heuristic before the real LuaJIT VM assembly. When the hidden lj_vm_asm_begin symbol is available, locate it through .symtab and select the large delta interval containing it. Preserve the existing heuristic as a fallback for stripped binaries. Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Tarantool inserts mem_L between global_State.cur_L and jit_base, so reading jit_base as the next field yields a lua_State pointer instead of the active JIT base. Extract jit_base from the trace-exit handler on amd64 and arm64, pass its offset to eBPF, and retain cur_L+8 as the OpenResty fallback. Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Tarantool's LuaJIT VM gate uses different C-frame layouts from OpenResty, and Lua runs on fiber stacks. Read the CFA offset and base register from the interpreter region's stack delta, derive the x86 JIT transition frame from it, and always step over the VM gate before returning to native unwinding. This preserves the native stack below lua_pcall and avoids ERROR_4012/4005 handback failures. Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Scan ELF symbols once, reject the OpenResty jit_base fallback for Tarantool, guard a transient NULL jit_base, centralize layout constants, and add direct amd64/arm64 extractor plus cframe boundary tests. Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
Assisted-By: devx/c2bfb8bf-4688-4938-9621-a3654ee983f3
dalehamel
marked this pull request as draft
August 28, 2026 19:15
dalehamel
force-pushed
the
dale/luajit-tarantool-parca
branch
from
August 28, 2026 19:15
39dd4c5 to
92085ce
Compare
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
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.
Summary
Ports Shopify's production Tarantool fixes for the LuaJIT unwinder onto Parca's merged extractor stack and includes the runtime corrections found while building deterministic coredump coverage in #317.
Final head:
39dd4c54(rebased ontoparca-dev/main@0cf69159).This builds on the merged extractor series:
asm/amddisp32centrally inasm/amdThe first five commits are the curated Tarantool runtime port through Shopify's deployed revision
7916b625. The final three commits select the correct runtime-specific x64 C-frame layout, classify Tarantool's proven arm64 fiber trampoline as a synthetic stack root, and rebuild both eBPF blobs. The obsolete intermediate blob-only rebuild was dropped during the rebase; the final blobs were regenerated from the complete source against currentmain. #317 remains a separate one-commit fixture/documentation change.This follows the request to feed downstream fixes back through the Parca fork for the next upstream batch of open-telemetry#1236.
Production evidence
The following completed production profile shows native Tarantool frames handing through
lua_pcallinto built-in Lua, application Lua, and LuaJIT FFI frames. The query identifier and application-specific Lua/schema labels are covered with solid opaque redactions; the image contains no node, cluster, or schedule identifier.Why Tarantool needs this
Parca's LuaJIT work primarily targets a dynamically linked OpenResty
libluajit-5.1.so. Tarantool differs in several relevant ways:tarantoolexecutable.lj_vm_asm_beginandlj_vm_exit_handlerare hidden in.symtab.global_State.mem_Lbetweencur_Landjit_base.coro_startupassembly trampoline has no CFI and is a synthetic stack root.Changes
Tarantool extraction and native handback
tarantoolexecutable in the existing LuaJIT loader.lj_vm_asm_beginwhen available.global_State.jit_baseindependently fromcur_L:lj_vm_exit_handlerwithasm/amdand asm/amd: sign-extend 32-bit memory displacements #314's centralized signed-disp32handling.x22-relativestr xzrin the exit handler.cur_L+8as the stripped OpenResty fallback, but fail Tarantool attachment if extraction is unavailable because that fallback is known to be wrong there.jit_baseinstead of subtracting from it.Runtime-specific previous C-frame layout
LuaJITProcInfonow carriescframe_prev_offset, selected by the same exact executable-name contract used by the loader:4*8)6*8)A zero field retains backward-compatible architecture-default behavior in eBPF, so old or zero-initialized map records remain valid. The Go/C ABI size is asserted as
0xe; generated Go types and both eBPF blobs are synchronized.Exact arm64 synthetic-root classification
Only the proven Tarantool trampoline becomes
UnwindInfoStop. Detection requires all of:.symtabsymbol named exactlycoro_startup.mov x0,x20; blr x19; btrampoline signature.The ELF string-table prefilter is capped at 16 MiB to match
VisitSymbols; malformed/oversized tables, bad links, invalid addresses, overflow, and instruction mismatches fail closed. STOP and restore boundaries are markedUnwindHintKeepso generic delta compaction cannot erase the exact interval. Arbitrary missing-CFI ranges remainUnwindInfoInvalid.Scope
Intentionally omitted:
Config.ExecutablesandUsesAnonymousMappings()plumbing, which is not present on this Parca stack. Exact basenametarantoolmatches the existing loader-recognition contract.sameRegworkaround; supported Tarantool builds are GC64 and luajit: migrate x86 lua_close & jit_checktrace extractors to asm/amd #276 removed that extractor path.Validation
Post-rebase validation was run in architecture-matched Linux environments:
go test ./...on linux/arm64, plus focusedinterpreter/luajit,support, andnativeunwind/elfunwindinfocoverage on linux/amd64 and linux/arm64.TestOffsetsandTestStructureagainst all 18 cached OpenResty binaries from the amd64 and arm64 build matrices.fibandcompon 1.19 and rolling Alpine images. The old 1.17 image exits withSIGILLunder the x86 QEMU VM, but remains covered by the offline binary matrix.clang-formatlint, generated-type consistency,gofmt, andgit diff --check.e807bc2bd92380cb0983190d7e11f8088d5381364b04429c88c97ea018bee09d2f95d1576241a12682a5b9bbed6903002969f97fad1c175294c6400850ec507bThe branch was rebased onto
parca-dev/main@0cf69159. Range-diff preserved every source commit; only the superseded intermediate blob rebuild was intentionally omitted. Both PRs remain ready for review.