Skip to content

Fix callback ID reuse race before sending responses - #2

Open
muratcakir wants to merge 1 commit into
gumbarros:mainfrom
muratcakir:codex/fix-callback-id-reuse
Open

muratcakir wants to merge 1 commit into
gumbarros:mainfrom
muratcakir:codex/fix-callback-id-reuse

Conversation

@muratcakir

Copy link
Copy Markdown

Problem
The compiler can legitimately reuse a callback ID after receiving its response.
ProtocolTransport may flush that response before the asynchronous send continuation
resumes. CompilationOperation currently retires the pending callback ID in that
continuation's finally block. An incoming request that reuses the ID during this
window is therefore rejected as a duplicate.

We observed this in Smartstore's Linux ARM64 CI with:
SassProtocolException: Duplicate pending ImportRequest callback ID 0.
This is a scheduling race in the managed protocol implementation, not inherently
an ARM64-only failure.

Fix
Retire the callback ID immediately before submitting its response to the sender.
Remove the continuation-based cleanup, which could otherwise remove a newly
registered callback using the same ID. Keep duplicate detection active while
the importer or custom function is still handling a request.
No public API, native compiler or protocol encoding changes are needed.

Regression coverage

  • Deterministic immediate ID reuse before the first sender completes for all four
    callback types: canonicalize, import, file import and function call.
  • Genuine duplicate IDs remain rejected while an importer is pending.
  • Completion of an earlier sender does not erase a reused, pending callback ID.

Validation
The original implementation failed the four immediate-reuse cases; the fixed
implementation passes all 54 protocol tests locally on Windows x64.
No native ARM64 integration run has been performed with this fix.

@muratcakir

Copy link
Copy Markdown
Author

Hello, anybody there? 🙋‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant