diff --git a/wasm/mix-fetch/go-mix-conn/internal/state/state.go b/wasm/mix-fetch/go-mix-conn/internal/state/state.go index ca05ff5812..4db50a1c49 100644 --- a/wasm/mix-fetch/go-mix-conn/internal/state/state.go +++ b/wasm/mix-fetch/go-mix-conn/internal/state/state.go @@ -92,7 +92,8 @@ func (ar *CurrentActiveRequests) InjectData(id types.RequestId, data []byte) { defer ar.Unlock() _, exists := ar.Requests[id] if !exists { - panic("attempted to write to connection that doesn't exist") + log.Error("attempted to inject data for connection %d that no longer exists — likely already cleaned up", id) + return } ar.Requests[id].injector.ServerData <- data } @@ -115,7 +116,8 @@ func (ar *CurrentActiveRequests) SendError(id types.RequestId, err error) { defer ar.Unlock() _, exists := ar.Requests[id] if !exists { - panic("attempted to inject error data to connection that doesn't exist") + log.Error("attempted to inject error for connection %d that no longer exists — likely already cleaned up", id) + return } ar.Requests[id].injector.RemoteError <- err } diff --git a/wasm/mix-fetch/src/active_requests.rs b/wasm/mix-fetch/src/active_requests.rs index 72fe6ac9d9..e0f61daa7f 100644 --- a/wasm/mix-fetch/src/active_requests.rs +++ b/wasm/mix-fetch/src/active_requests.rs @@ -69,7 +69,8 @@ impl ActiveRequests { let mut guard = self.inner.lock().await; let old = guard.remove(&id); if old.is_none() { - console_error!("attempted to reject request {id}, but it seems to have never existed?") + console_error!("attempted to reject request {id}, but it no longer exists — likely already cleaned up by Go timeout"); + return; } goWasmInjectConnError(id.to_string(), err.to_string())