Unhandled "provider is closed" inside the runtime's own error handler terminates the host process
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Inizia con il percorso di errore di napi-oop-runtime mostrato in dist/index.js e i frame filterSecrets, writeLog e handleError in app.js; riproduci un dispatch dello strumento in corso seguito dalla disposizione della sessione. È completo quando un errore successivo alla chiusura viene segnalato senza usare ricorsivamente il provider chiuso e l’host rimane in esecuzione con un errore operativo intercettabile.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Environment: @github/copilot 1.0.71 (win32-x64), Node v24.16.0, .NET 8 host embedding the SDK in-process (napi-oop-runtime).
Summary
When a tool-call result is written to a session after its provider has been closed, the runtime raises Error: provider is closed. Its error handler then logs that failure through the same closed provider, which throws a second time inside the handler. That second throw is unhandled and terminates the host process with 0xC0000005 (access violation) rather than failing the operation.
Error: provider is closed
at Object.call (napi-oop-runtime/dist/index.js:68:2208)
at Proxy.S (napi-oop-runtime/dist/index.js:68:3671)
at t.filterSecrets (app.js:114:26376)
at wR.filterSecrets (app.js:143:52707)
at wR.error (app.js:651:10732)
at wR.writeLog (app.js:652:163)
at Hle.logToLevel (app.js:61:1536)
at Hle.error (app.js:61:1719)
at t.handleError (app.js:5076:625)
at process.<anonymous> (app.js:5076:360)
The final two frames are the process-level handler, so there is nothing left to catch it.
Reproduction shape
- Create a session and subscribe to
ExternalToolRequestedEvent. - Dispatch the tool asynchronously — the event handler cannot await it, so the dispatch is fire-and-forget.
- Dispose the session while a dispatch is still in flight, for example because the turn was cancelled by a deadline.
- The dispatch completes and calls
session.Rpc.Tools.HandlePendingToolCallAsync(...)on the now-closed session.
Observed reliably on a long-running host that creates one session per turn against a process-wide client.
Impact
The whole host process dies, not just the affected session. For a service embedding the SDK, every concurrent operation in that process is lost, and the failure surfaces as a process exit rather than an exception the caller can handle. A caller cannot defend against this in managed code either, since an access violation is not catchable.
Suggested fix
Make the error-handling path resilient to a closed provider. filterSecrets / writeLog reach back into the provider while handling an error that the provider itself raised; falling back to a local sink when the provider is unavailable would keep the secondary failure inside handleError instead of letting it escape.
More generally, an error raised because a resource is closed should not be reported through that same resource.
Workaround
On the caller side: gate any post-dispatch write on session liveness, and drain in-flight dispatches before disposing the session. That removes the trigger but not the underlying fragility — any other error raised after provider close will still terminate the process.
- Lingua principale
- Java
- Stelle
- 10.5k
- Fork
- 1.5k
- Merge medio
- 1g 9h
- PR unite (30g)
- 130
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di github/copilot-sdk
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2760 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2759 ·
-
documentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
github/copilot-sdk#2758 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
github/copilot-sdk#2709 · 1 commento ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
github/copilot-sdk#2673 ·
Tutte le issue di github/copilot-sdk
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
frontend maui-pilot pilot-ask question
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·