Title: fix(worker): tear down a worker runtime whose Java bootstrap failed by adrian-niculescu · Pull Request #2069 · NativeScript/android · GitHub
Open Graph Title: fix(worker): tear down a worker runtime whose Java bootstrap failed by adrian-niculescu · Pull Request #2069 · NativeScript/android
X Title: fix(worker): tear down a worker runtime whose Java bootstrap failed by adrian-niculescu · Pull Request #2069 · NativeScript/android
Description: A worker whose bootstrap fails after its native runtime is up, for example because internal/ts_helpers.js throws, reports the error to its parent but leaves the native runtime and its isolate allocated for the rest of the process. Runtime.initWorkerRuntime creates the native runtime in runtime.init() and then runs ts_helpers.js. When that throws, the Java side rolls back its own caches and rethrows, so the call never returns the runtime id, WorkerWrapper::runtime_ stays null, and BackgroundLooper skips the teardown that disposes the isolate. The native runtime is still the thread's current runtime (PrepareV8Runtime sets it last, and UnwindFailedInit clears it when native init itself fails), so shutdown now takes it from there when runtime_ is null and tears it down on the existing path, detaching it from Java by its own id. That id matters when the failure comes after the Java runtime finished initializing, for example a logger that throws on its last line: Java still holds that runtime and its GC subscription, and detaching with the -1 the call never replaced would leave both pointing at the deleted native runtime. With ts_helpers.js patched to throw in workers, a failed worker on main leaves its runtime current after shutdown, and with this change the runtime is gone and the error still reaches the parent once. That needs a patched asset, so there is no spec for it. The full device suite passes. Summary by CodeRabbit Bug Fixes Improved cleanup when app startup fails, helping prevent a native runtime from being left undisposed. This includes cases where a native runtime is created but startup does not return its identifier; shutdown can now locate the runtime and complete the existing cleanup steps.
Open Graph Description: A worker whose bootstrap fails after its native runtime is up, for example because internal/ts_helpers.js throws, reports the error to its parent but leaves the native runtime and its isolate alloc...
X Description: A worker whose bootstrap fails after its native runtime is up, for example because internal/ts_helpers.js throws, reports the error to its parent but leaves the native runtime and its isolate alloc...
Opengraph URL: https://github.com/NativeScript/android/pull/2069
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cf4770f0-957c-1617-f808-2aca50b38e36 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | D95E:19F84C:1A79CA4:21C2785:6B0138E7 |
| html-safe-nonce | 5c06c4b0c9300ef6e192e007b21651aa2911a078dda3985e95df027b7cc29c2a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTVFOjE5Rjg0QzoxQTc5Q0E0OjIxQzI3ODU6NkIwMTM4RTciLCJ2aXNpdG9yX2lkIjoiNTMyNjc0MTcyOTMzMDY3Mzg5NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6aa87561b580ccc496cb39fc1e1f4804ec6054d56435df7dcd1439768f4fe422 |
| hovercard-subject-tag | pull_request:4764892640 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/2069/files |
| twitter:image | https://avatars.githubusercontent.com/u/15037449?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/15037449?s=400&v=4 |
| og:image:alt | A worker whose bootstrap fails after its native runtime is up, for example because internal/ts_helpers.js throws, reports the error to its parent but leaves the native runtime and its isolate alloc... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/NativeScript/android git https://github.com/NativeScript/android.git |
| octolytics-dimension-user_id | 7392261 |
| octolytics-dimension-user_login | NativeScript |
| octolytics-dimension-repository_id | 29137950 |
| octolytics-dimension-repository_nwo | NativeScript/android |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29137950 |
| octolytics-dimension-repository_network_root_nwo | NativeScript/android |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width