{"record":{"id":"6a1e59ae29ed69e5","repo":"nautechsystems/nautilus_trader","slug":"failed-to-terminate-binance-spot-session-tasks-e","errorCode":null,"errorMessage":"Failed to terminate Binance Spot session tasks: {e}","messagePattern":"Failed to terminate Binance Spot session tasks: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/execution.rs","lineNumber":608,"sourceCode":"\n    fn abort_pending_tasks(&self) {\n        crate::common::execution::abort_pending_tasks(&self.pending_tasks);\n    }\n\n    fn abort_session_tasks(&self) {\n        self.session_tasks.begin_shutdown();\n    }\n\n    async fn await_pending_tasks(&self) -> anyhow::Result<()> {\n        crate::common::execution::await_pending_tasks(&self.pending_tasks).await\n    }\n\n    async fn await_session_tasks(&self) -> anyhow::Result<()> {\n        self.session_tasks.begin_shutdown();\n        self.session_tasks\n            .finish_shutdown(Duration::from_secs(1), Duration::from_secs(2))\n            .await\n            .map_err(|e| anyhow::anyhow!(\"Failed to terminate Binance Spot session tasks: {e}\"))?;\n        Ok(())\n    }\n\n    async fn ws_setup_failure(\n        &mut self,\n        mut ws_trading: BinanceSpotWsTradingClient,\n        reason: String,\n    ) -> anyhow::Error {\n        ws_trading.mark_user_data_inactive();\n        log::error!(\"{reason}; Binance Spot private user data is required for execution\");\n\n        self.abort_session_tasks();\n\n        if let Err(e) = ws_trading.disconnect().await {\n            log::warn!(\"Failed to stop Binance Spot trading WebSocket after setup failure: {e}\");\n        }\n        self.disconnect_us_user_data().await;\n","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/execution.rs#L590-L626","documentation":"Teardown failure in await_session_tasks: terminating the Binance Spot session task group timed out or failed during connect error handling; the original failure is augmented with this termination error.","triggerScenarios":"Thrown at crates/adapters/binance/src/spot/execution.rs:608 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the underlying task-group shutdown error","Ensure no session tasks are deadlocked (check WS client state) and retry connect"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}