Fix cross-runtime panic in mix-fetch when timed-out requests receive
late error injection - Add early return in reject() when request is already gone from Rust map - Replace panic with log + return in SendError and InjectData
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user