Attempt to handle async web API unwinds#20
Open
Robert0303-C wants to merge 1 commit into
Open
Conversation
Author
|
/claim |
The issue is that both setjmp/longjmp and async web APIs use the same asyncify mechanism (pl_asyncify_unwind_buf), causing re-entrancy conflicts when an async web API call happens during a setjmp context. Solution: Add a separate unwind buffer for async web API operations that is isolated from the setjmp unwind state: 1. machine.h/c: Add async_web_api_unwind(), async_web_api_stop(), async_web_api_handle_unwind() with separate _async_web_api_buf 2. runtime.c: Check async_web_api_handle_unwind() in the asyncify handling loop to properly handle async web API rewind This allows setjmp and async web APIs to coexist without conflicts. Fixes 6over3#7
a78606b to
e8c90ac
Compare
Author
|
/claim |
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.
This is an attempt to address issue #7 - Asynchronous Web APIs.
The Problem
zeroperl uses asyncify for setjmp/longjmp (from ruby/wasm), and there's a conflict when trying to use asyncify for async web APIs via the --asyncify --pass-arg=asyncify-imports@... build flags.
The core issue is that both asyncify uses share the same state machine, which can cause:
This Attempt
This change attempts to isolate async web API unwinds from setjmp unwinds by:
Limitations
However, the fundamental issue is that both asyncify transformations share the same asyncify state machine. The re-entrancy issues mentioned in asyncify releases (https://github.com/GoogleChromeLabs/asyncify/releases) suggest this is a known problem.
A proper fix likely requires:
The issue was originally closed as "completed" with a note that "This has been identified as a bug in asyncify runtime and the bounty is now reserved for it's maintainer."
Testing
This change compiles but has not been extensively tested due to the complexity of the asyncify interaction.