Repository navigation
fix: scope native serial callbacks with MakeCallback - #243
Open
DragonWork wants to merge 2 commits into
Open
DragonWork wants to merge 2 commits into
DragonWork wants to merge 2 commits into
Conversation
DragonWork
force-pushed
the
fix/windows-async-callbacks
branch
from
September 9, 2026 23:55
932084a to
42279d6
Compare
DragonWork
force-pushed
the
fix/windows-async-callbacks
branch
from
September 10, 2026 00:12
42279d6 to
3fbc715
Compare
Contributor
|
Project rip :( |
Author
|
Maybe someone (or better a group of devs) fork it and maintain the project. Or the original codeowner comes back. Let‘s hope for the best. |
DragonWork
commented
Sep 10, 2026
dashersw
added a commit
to geastack/cli
that referenced
this pull request
Oct 15, 2026
@serialport/bindings-cpp completes Windows reads and writes on its own thread and calls back into JavaScript from a uv_async handle with a plain napi Call. Since Node.js 26.4 nothing drains the microtask queue after such a call (nodejs/node#66158), so the promise the binding resolves continues only when some other macrotask runs. On Windows every GEADEV command waited for the next timer or console line: the USB app update timed out and fell back to the ROM downloader (BOOT), and a chatty app stalled on a console the host had stopped draining. Until the binding scopes its callbacks (serialport/bindings-cpp#243), loadSerialport wraps the native read/write so each callback queues a setImmediate, after which Node drains microtasks. It has to run before load-bindings.js promisifies them, so `gea doctor` loads serialport through it too. Writes on Node 26.7 went from 2 s timeouts to 0-1 ms; neon (3.9 MB) installs over a running reel through the app in 54 s, as on Node 24. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dashersw
added a commit
to geastack/cli
that referenced
this pull request
Oct 15, 2026
@serialport/bindings-cpp completes Windows reads and writes on its own thread and calls back into JavaScript from a uv_async handle with a plain napi Call. Since Node.js 26.4 nothing drains the microtask queue after such a call (nodejs/node#66158), so the promise the binding resolves continues only when some other macrotask runs. On Windows every GEADEV command waited for the next timer or console line: the USB app update timed out and fell back to the ROM downloader (BOOT), and a chatty app stalled on a console the host had stopped draining. Until the binding scopes its callbacks (serialport/bindings-cpp#243), loadSerialport wraps the native read/write so each callback queues a setImmediate, after which Node drains microtasks. It has to run before load-bindings.js promisifies them, so `gea doctor` loads serialport through it too. Writes on Node 26.7 went from 2 s timeouts to 0-1 ms; neon (3.9 MB) installs over a running reel through the app in 54 s, as on Node 24.
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.
Use
MakeCallback()with anAsyncContextfor Unix poller events and Windows read/write completions, including error paths. This prevents stalled nextTick/Promise continuations and preserves async context.Preserves @Azq2's original commit from #239, followed by explicit async contexts and Windows support. Listener ordering (#240) is unchanged.
Linux/Node 26.8.2: native timing/context check, build, typecheck and 74 existing tests pass (2 skipped). Windows and macOS runtime testing is still needed.