René's URL Explorer Experiment


Title: fix(worker): handle terminate() landing inside require() by edusperoni · Pull Request #2115 · NativeScript/android · GitHub

Open Graph Title: fix(worker): handle terminate() landing inside require() by edusperoni · Pull Request #2115 · NativeScript/android

X Title: fix(worker): handle terminate() landing inside require() by edusperoni · Pull Request #2115 · NativeScript/android

Description: Description The test app aborted in CI on a worker thread (run 43933815022, attempt 1; the rerun passed): NS_CHECK failed: success && !result.IsEmpty() && result->IsFunction(), at ModuleInternal.cpp:302 tns::OnCheckFailed tns::ModuleInternal::GetRequireFunction tns::ModuleInternal::LoadModule tns::ModuleInternal::LoadImpl tns::ModuleInternal::RequireCallbackImpl Cause. Each directory's require is minted by calling the JS require factory, and entering that function is an interrupt check. If the parent's worker.terminate() reached the worker's isolate since its previous check, the termination surfaces there: the call comes back empty, and the NS_CHECK on its result takes the whole app down. The window opens once the worker has passed its own isTerminating_ check and is loading its entry module, so new Worker(...), a few milliseconds of work on the parent, then terminate() is enough. The CI run most likely hit it in the shared spec "Send many objects from worker object without waiting for response and terminate" (inferred from the logcat timing and the spec order, not observed directly). createRequire() reaches the same call from JS at any point in a worker's life. Every other step of LoadModule that runs JS already treats an interrupted call as a failed load; this one asserted instead. Fix (first commit). GetRequireFunction returns a MaybeLocal and leaves the termination pending: LoadModule throws the same NativeScriptException(tc, …) its neighbours throw, so the load unwinds exactly like a terminate() that lands in the module body. Nothing is reported: CallWorkerScopeOnErrorHandle already stays silent for a terminating worker. createRequire returns to JS with the termination pending. The mint done while the runtime boots keeps the hard check, since terminate() cannot reach the isolate before it is published. Nothing is cached for an interrupted mint. Termination lost on rethrow (second commit). Review of the first commit pointed at the path that throw joins: a failed native callback rethrows through NativeScriptException::ReThrowToV8, and Isolate::ThrowException replaces whatever is pending. A pending termination became an ordinary exception, so a worker that wraps require() in try/catch caught it and kept running after terminate(). This predates the first commit (a terminate() landing in a required module's body goes the same way) and is not specific to require. ReThrowToV8 now leaves a pending termination alone, checking both on entry and again right before the throw, since building the error can itself run JS (third commit; that recheck was verified by CI only, not by the local runs below). Does your commit message include the wording below to reference a specific issue in this repo? No issue. Related Pull Requests #2113: the PR whose CI run surfaced the abort. It is unrelated to the cause: it does not touch the module loader or the worker code, and the abort reproduces on main (below). Does your pull request have unit tests? Two specs: testWorkerTerminateDuringRequireMint.js covers the abort through the createRequire route: it starts a worker that mints requires in a loop and terminates it once it reports it is spinning, 25 times. On main (b8cc3cf) it aborted the app with the NS_CHECK above in the one run I made; with this PR it passes. testWorkerTerminateCaughtRequire.js covers the lost termination: a worker requires a module that spins inside try/catch, and the parent terminates it there. With only the first commit it failed (the worker ran the code after its catch); with the second it passes. The entry-module route CI hit is too narrow to reach from a spec by timing alone, so it was verified with a temporary usleep(500000) before the factory call on worker isolates, plus a log line when the call comes back empty (arm64 API 36 emulator, neither is in this PR): Build Result of runtestsAndVerifyResults main + delay abort with the stack above; the log reads factory call success=0 terminating=1 right before it this PR + delay 1600 specs, 0 failures; 30 interrupted mints logged (5 module loads, 25 createRequire calls), no abort, no worker error reported this PR 1600 specs, 0 failures

Open Graph Description: Description The test app aborted in CI on a worker thread (run 43933815022, attempt 1; the rerun passed): NS_CHECK failed: success && !result.IsEmpty() && result->IsFunction(), a...

X Description: Description The test app aborted in CI on a worker thread (run 43933815022, attempt 1; the rerun passed): NS_CHECK failed: success && !result.IsEmpty() && result-&am...

Opengraph URL: https://github.com/NativeScript/android/pull/2115

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:d5e46187-ac53-7d89-bc34-69eb0a8fd042
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9962:34DB8F:14C020E:1BB5A27:6B013811
html-safe-nonceb464d32209a7b14ba677e187064172e3a971d73e91d78f383c90cc7fb902f802
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OTYyOjM0REI4RjoxNEMwMjBFOjFCQjVBMjc6NkIwMTM4MTEiLCJ2aXNpdG9yX2lkIjoiNTQ4ODUwOTM4NzYxMTkxMjIwOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac40811e8c4e96f095afb22354f71ca17499fcbcb1c624b62fcd6b06d8e5b12511
hovercard-subject-tagpull_request:5343726268
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/NativeScript/android/pull/2115/files
twitter:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/4061767?s=400&v=4
og:image:altDescription The test app aborted in CI on a worker thread (run 43933815022, attempt 1; the rerun passed): NS_CHECK failed: success && !result.IsEmpty() && result->IsFunction(), a...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/NativeScript/android git https://github.com/NativeScript/android.git
octolytics-dimension-user_id7392261
octolytics-dimension-user_loginNativeScript
octolytics-dimension-repository_id29137950
octolytics-dimension-repository_nwoNativeScript/android
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id29137950
octolytics-dimension-repository_network_root_nwoNativeScript/android
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/NativeScript/android/pull/2115/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2115%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FNativeScript%2Fandroid%2Fpull%2F2115%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=NativeScript%2Fandroid
Reloadhttps://github.com/NativeScript/android/pull/2115/files
Reloadhttps://github.com/NativeScript/android/pull/2115/files
Reloadhttps://github.com/NativeScript/android/pull/2115/files
NativeScripthttps://github.com/NativeScript
androidhttps://github.com/NativeScript/android
Codehttps://github.com/NativeScript/android
Issues106 (106)https://github.com/NativeScript/android/issues
Pull requests24 (24)https://github.com/NativeScript/android/pulls
Actionshttps://github.com/NativeScript/android/actions
Projectshttps://github.com/NativeScript/android/projects
Wikihttps://github.com/NativeScript/android/wiki
Security and qualityhttps://github.com/NativeScript/android/security
Insightshttps://github.com/NativeScript/android/insights
Sign up for GitHub https://github.com/signup?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FNativeScript%2Fandroid%2Fissues%2Fnew%2Fchoose
edusperonihttps://github.com/edusperoni
mainhttps://github.com/NativeScript/android/tree/main
fix/worker-require-terminate-aborthttps://github.com/NativeScript/android/tree/fix/worker-require-terminate-abort
Conversation 7 https://github.com/NativeScript/android/pull/2115
Commits 3 https://github.com/NativeScript/android/pull/2115/commits
Checks 8 https://github.com/NativeScript/android/pull/2115/checks
Files changed https://github.com/NativeScript/android/pull/2115/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
fix(worker): handle terminate() landing inside require() https://github.com/NativeScript/android/pull/2115/files#top
Show all changes 3 commits https://github.com/NativeScript/android/pull/2115/files
cd5a54c fix(worker): survive terminate() while creating a require function edusperoni Nov 16, 2026 https://github.com/NativeScript/android/pull/2115/commits/cd5a54c4fc520a4edfc07a8cd93b1f75731b0b34
4fa3efd fix(worker): keep terminate() pending across a native rethrow edusperoni Nov 16, 2026 https://github.com/NativeScript/android/pull/2115/commits/4fa3efd08d19b1edabd05e387db0d0242e3a97a8
848d8ce fix(worker): recheck for termination before the native rethrow edusperoni Nov 16, 2026 https://github.com/NativeScript/android/pull/2115/commits/848d8ce8ca987cba821c611e5085fd51b9b143ea
Clear filters https://github.com/NativeScript/android/pull/2115/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
mainpage.js https://github.com/NativeScript/android/pull/2115/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
testWorkerTerminateCaughtRequire.js https://github.com/NativeScript/android/pull/2115/files#diff-178422cfe68e0c3cf7bff216ff37b65e494cab9ead71948a3d45b1389c04cba8
testWorkerTerminateDuringRequireMint.js https://github.com/NativeScript/android/pull/2115/files#diff-39c6067e56518da9714902e3594d882fcb2e6f780e081c60ab2943822edf7bca
workerRequireMintSpinWorker.js https://github.com/NativeScript/android/pull/2115/files#diff-ec9f6834a9a2fc5baea5b270a2cec4e17b0760c4807a5ce39ed8d932f8a86c3b
workerTerminateCaughtRequireWorker.js https://github.com/NativeScript/android/pull/2115/files#diff-7f8a0fe80ee6d325876234a8203c72cd782459a4fb80d88c0dc6b900a6161805
ModuleInternal.cpp https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
ModuleInternal.h https://github.com/NativeScript/android/pull/2115/files#diff-8da8e7bc6d95d45b2bab7f0cf2e755904507ef353fc448729a0824a2197a4fff
NativeScriptException.cpp https://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
test-app/app/src/main/assets/app/mainpage.jshttps://github.com/NativeScript/android/pull/2115/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/app/src/main/assets/app/mainpage.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2115/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
https://github.com/NativeScript/android/pull/2115/files#diff-b7fd6c22bfc29391e9e3ed935d6c6194b1ad595c7592690229952b5ddb99c0d5
test-app/app/src/main/assets/app/tests/testWorkerTerminateCaughtRequire.jshttps://github.com/NativeScript/android/pull/2115/files#diff-178422cfe68e0c3cf7bff216ff37b65e494cab9ead71948a3d45b1389c04cba8
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/app/src/main/assets/app/tests/testWorkerTerminateCaughtRequire.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/testWorkerTerminateDuringRequireMint.jshttps://github.com/NativeScript/android/pull/2115/files#diff-39c6067e56518da9714902e3594d882fcb2e6f780e081c60ab2943822edf7bca
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/app/src/main/assets/app/tests/testWorkerTerminateDuringRequireMint.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/workerRequireMintSpinWorker.jshttps://github.com/NativeScript/android/pull/2115/files#diff-ec9f6834a9a2fc5baea5b270a2cec4e17b0760c4807a5ce39ed8d932f8a86c3b
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/app/src/main/assets/app/tests/workerRequireMintSpinWorker.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
test-app/app/src/main/assets/app/tests/workerTerminateCaughtRequireWorker.jshttps://github.com/NativeScript/android/pull/2115/files#diff-7f8a0fe80ee6d325876234a8203c72cd782459a4fb80d88c0dc6b900a6161805
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/app/src/main/assets/app/tests/workerTerminateCaughtRequireWorker.js
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
test-app/runtime/src/main/cpp/ModuleInternal.cpphttps://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/runtime/src/main/cpp/ModuleInternal.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
https://github.com/NativeScript/android/pull/2115/files#diff-8fb647a9437c57deb39dc2079f0cdfc94a75fafef82b46766fd7d1d276af246e
test-app/runtime/src/main/cpp/ModuleInternal.hhttps://github.com/NativeScript/android/pull/2115/files#diff-8da8e7bc6d95d45b2bab7f0cf2e755904507ef353fc448729a0824a2197a4fff
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/runtime/src/main/cpp/ModuleInternal.h
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2115/files#diff-8da8e7bc6d95d45b2bab7f0cf2e755904507ef353fc448729a0824a2197a4fff
https://github.com/NativeScript/android/pull/2115/files#diff-8da8e7bc6d95d45b2bab7f0cf2e755904507ef353fc448729a0824a2197a4fff
test-app/runtime/src/main/cpp/NativeScriptException.cpphttps://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
View file https://github.com/NativeScript/android/blob/848d8ce8ca987cba821c611e5085fd51b9b143ea/test-app/runtime/src/main/cpp/NativeScriptException.cpp
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/NativeScript/android/pull/2115/{{ revealButtonHref }}
https://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
https://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
https://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
https://github.com/NativeScript/android/pull/2115/files#diff-93d70766ca3edeb71b49baba2158c55cc56fbd8a53a22f093384344d5a3cb0f3
Please reload this pagehttps://github.com/NativeScript/android/pull/2115/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.