fetch/XHR transport failures and unhandled rejections lose all diagnostic fidelity before reaching the embedding app
Les mainteneurs répondent en général sous 1 jour
@bkaradzic-microsoft y travaille déjà.
Depuis le 16/6/2026.
- #204 par @bkaradzic-microsoft — fermée sans fusion
Évaluation
Cette issue n'a pas encore été évaluée.
Description
Applications embedding Babylon Native depend on field crash reports for ongoing maintenance, and today a fetch()/XMLHttpRequest failure arrives there with no usable signal: DNS failure, connection refused, TLS rejection, proxy auth failure, server outage, and a missing bundled app:/// asset are all byte-identical, and an un-caught rejection never reaches the host (BN) application at all. This issue tracks the chain of fixes; each hop is independently shippable.
The chain (where fidelity is lost today)
-
UrlLib swallows transport errors at the source.✅ Fixed by BabylonJS/UrlLib#31 (open): the Apple backend discarded theNSError(long-standing in-code TODO) and the curl backend caught and dropped its own failure, leaving onlyStatusCode() == 0. UrlLib now exposesErrorString()/ErrorSymbol()/ErrorCode(), normalized as"<domain>:<symbol>(<code>): <detail>"(e.g.curl:CURLE_COULDNT_RESOLVE_HOST(6): ...,nsurl:NSURLErrorCannotConnectToHost(-1004): ...,urllib:AppResourceNotFound(0): ...) — stable tokens for observability-pipeline filtering, purely additive (status-0 contract unchanged). -
The fetch polyfill flattens every transport failure to a constant string.
Fetch.cppthrowsstd::runtime_error{"fetch: network request failed"}, discardingresult.error()and the URL/method context it has in scope; the rejection surfaces as a plainError(browsers/Node/Bun:TypeError) with nocause, nocode, and a.stacksnapshotted inside the scheduler tick — i.e. zero user frames. Proposed shape, once the UrlLib pin includes #31:- reject with a
TypeErrorwhose message is stable ("fetch failed"style — keeps crash-report grouping intact), carrying the variable detail as properties:cause(message fromErrorString()),code(ErrorSymbol()),url; - capture the JS call-site stack synchronously inside
fetch()beforeSendAsync()(create the rejection Error, or a stack carrier, while user frames are still on the stack — the undici approach) so crash reports can attribute the failing call; - same treatment for
XMLHttpRequest's error path.
- reject with a
-
Unhandled promise rejections never reach
UnhandledExceptionHandler.AppRuntime::Dispatchonly catches synchronousNapi::Errorthrows from dispatched callbacks; no engine-level rejection tracker is wired anywhere in Core, so a fire-and-forgetfetch()failure (or a throw inside any.then) vanishes silently — the embedder's handler never fires and the process exits 0. Proposal: an opt-inAppRuntime::Optionshandler (or routing into the existing one) fed per engine —Isolate::SetPromiseRejectCallback(V8),JsSetHostPromiseRejectionTracker(Chakra),JSGlobalContextSetUnhandledRejectionCallback(JavaScriptCore), and the JSI tracker — the per-engine seams already exist asAppRuntime_{V8,Chakra,JavaScriptCore,JSI}.cpp. -
fetchignoresinit.signal. The implementation passesarcana::cancellation::none()for both continuations, so abort never rejects (AbortError) and never cancels the transport. Two prerequisites:UrlRequest::Abort()currently only cancels the Windows backend (the curl/NSURLSession backends never observem_cancellationSource), and theAbortSignalpolyfill predates the modern spec (noreason/throwIfAborted(), writableaborted). Worth sequencing with BabylonJS/BabylonNative#1708, which installsAbortControllerglobally in the Playground — after which library feature-detection passes while signals silently no-op, and user-initiated cancellations become indistinguishable from network failures in telemetry.
Validation
Beyond unit tests per hop (UrlLib#31 already ships offline-deterministic transport-failure tests + CI), the highest-value conformance ports for this area: the WPT fetch/api/abort/general.any.js core cases (pre-aborted/mid-flight/post-settle, signal.reason), undici's fetch failed-with-cause assertions from test/fetch/client-fetch.js, a four-way failure-shape bank (refused / NXDOMAIN / bad TLS / missing local asset must be distinguishable and TypeError-shaped), and a native-side test that an unhandled rejection actually reaches the host handler.
Happy to submit PRs for hops 2–4 individually (2 is unblocked as soon as the UrlLib pin can include #31; 3 and 4 are independent).
Related: #188 (fetch polyfill), #195 (statusText — same UrlLib-consumption pattern hop 2 would follow), BabylonJS/BabylonNative#1707.
- Langage dominant
- C++
- Étoiles
- 22
- Forks
- 23
- Merge moyen
- 6 h 17 min
- PR mergées (30 j)
- 4
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de BabylonJS/JsRuntimeHost
-
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
BabylonJS/JsRuntimeHost#234 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
BabylonJS/JsRuntimeHost#173 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
BabylonJS/JsRuntimeHost#241 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
BabylonJS/JsRuntimeHost#228 ·
Les mainteneurs répondent en général sous 1 jour
-
napi_unwrap does not reject objects that were never wrapped (V8 port faults, QuickJS port confuses types)Peut-être pris @bghgary l’a pris il y a 56 jours. Ouverte
Difficulté 4/5 3-5 jours Accessibilité débutants 68/100
BabylonJS/JsRuntimeHost#226 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de BabylonJS/JsRuntimeHost
Issues similaires
-
Web3 RPC: one-element batch request returns an object instead of an array (breaks ethers.js v6)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
FISCO-BCOS/FISCO-BCOS#5706 ·
Les mainteneurs répondent en général sous 3 jours
-
[开源推荐] Windows 系统维护工具箱,支持后台任务队列Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 85/100
521xueweihan/HelloGitHub#4011 ·
-
docs(simulation): Quickstart publishes UDP 14550, which the SITL images' own docs say not to doOuvertestatus:needs-triage
Difficulté 1/5 1-3 heures Accessibilité débutants 78/100
PX4/PX4-Autopilot#29292 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
I/O internal correctness medium priority rt_lib
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Les mainteneurs répondent en général sous 1 jour
-
GUI
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
sonic-pi-net/sonic-pi#3594 ·