nautechsystems/nautilus_trader · error
Failed to terminate Binance Spot session tasks: {e}
Error message
Failed to terminate Binance Spot session tasks: {e} What it means
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.
Source
Thrown at crates/adapters/binance/src/spot/execution.rs:608
fn abort_pending_tasks(&self) {
crate::common::execution::abort_pending_tasks(&self.pending_tasks);
}
fn abort_session_tasks(&self) {
self.session_tasks.begin_shutdown();
}
async fn await_pending_tasks(&self) -> anyhow::Result<()> {
crate::common::execution::await_pending_tasks(&self.pending_tasks).await
}
async fn await_session_tasks(&self) -> anyhow::Result<()> {
self.session_tasks.begin_shutdown();
self.session_tasks
.finish_shutdown(Duration::from_secs(1), Duration::from_secs(2))
.await
.map_err(|e| anyhow::anyhow!("Failed to terminate Binance Spot session tasks: {e}"))?;
Ok(())
}
async fn ws_setup_failure(
&mut self,
mut ws_trading: BinanceSpotWsTradingClient,
reason: String,
) -> anyhow::Error {
ws_trading.mark_user_data_inactive();
log::error!("{reason}; Binance Spot private user data is required for execution");
self.abort_session_tasks();
if let Err(e) = ws_trading.disconnect().await {
log::warn!("Failed to stop Binance Spot trading WebSocket after setup failure: {e}");
}
self.disconnect_us_user_data().await;
View on GitHub (pinned to 18893faf8b)
Solutions
- Inspect the underlying task-group shutdown error
- Ensure no session tasks are deadlocked (check WS client state) and retry connect
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at crates/adapters/binance/src/spot/execution.rs:608 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/6a1e59ae29ed69e5.
Report an issue: GitHub.