{"record":{"id":"9c520e08e845e45e","repo":"SignalR/SignalR","slug":"the-queue-is-full","errorCode":null,"errorMessage":"The queue is full.","messagePattern":"The queue is full\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Microsoft.AspNet.SignalR.Core/Messaging/ScaleoutStream.cs","lineNumber":116,"sourceCode":"\n                var context = new SendContext(this, send, state);\n\n                if (_initializeDrainTask != null && !_initializeDrainTask.IsCompleted)\n                {\n                    // Wait on the draining of the queue before proceeding with the send\n                    // NOTE: Calling .Wait() here is safe because the task wasn't created on an ASP.NET request thread\n                    //       and thus has no captured sync context\n                    _initializeDrainTask.Wait();\n                }\n\n                if (UsingTaskQueue)\n                {\n                    Task task = _queue.Enqueue(Send, context);\n\n                    if (task == null)\n                    {\n                        // The task is null if the queue is full\n                        throw new InvalidOperationException(Resources.Error_TaskQueueFull);\n                    }\n\n                    // Always observe the task in case the user doesn't handle it\n                    return task.Catch(_trace);\n                }\n\n                return Send(context);\n            }\n        }\n\n        public void SetError(Exception error)\n        {\n            Trace(TraceEventType.Error, \"Error has happened with the following exception: {0}.\", error);\n\n            lock (_lockObj)\n            {\n                _perfCounters.ScaleoutErrorsTotal.Increment();\n                _perfCounters.ScaleoutErrorsPerSec.Increment();","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/SignalR/SignalR/blob/693053b89a9e1f5ce819e3233ed159a6409de22b/src/Microsoft.AspNet.SignalR.Core/Messaging/ScaleoutStream.cs#L98-L134","documentation":"Thrown by ScaleoutStream.Send when UsingTaskQueue is true and _queue.Enqueue returns null, meaning the task queue has reached its maximum capacity. This is backpressure: the scaleout stream's send queue (bounded by configuration.MaxQueueLength) is full because messages are arriving faster than the backplane can acknowledge them. The stream cannot buffer any more messages and rejects the send.","triggerScenarios":"The scaleout backplane is slow or unresponsive, causing the send queue to fill up to MaxQueueLength. Each call to Send attempts _queue.Enqueue; when the queue is at capacity it returns null and the exception fires. Common during backplane outages or severe network latency.","commonSituations":"Redis/SQL/Service Bus backplane is down or slow; sudden message burst exceeding backplane throughput; MaxQueueLength configured too small for the load; network partition between app servers and backplane; the backplane connection is in a buffering state for too long.","solutions":["Investigate backplane health — check Redis/SQL/Service Bus latency and capacity.","Increase MaxQueueLength in ScaleoutConfiguration if the backplane can sustain higher catch-up load.","Implement client-side throttling or message batching to reduce send rate.","Consider a higher-throughput backplane (e.g., Redis over Service Bus)."],"exampleFix":"// before — default small queue\nvar config = new ScaleoutConfiguration() { MaxQueueLength = 50 };\n\n// after — larger queue to absorb bursts\nvar config = new ScaleoutConfiguration() { MaxQueueLength = 1000 };","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    streamManager.Send(streamIndex, messages);\n} catch (InvalidOperationException ex) when (ex.Message.Contains(\"queue is full\")) {\n    // Backpressure — back off and retry, or drop/throttle\n    logger.Warn(\"Scaleout queue full, applying backpressure\", ex);\n    await Task.Delay(backoffDelay);\n    // consider reducing send rate or increasing MaxQueueLength\n}","preventionTips":["Size MaxQueueLength appropriately for peak message throughput.","Monitor scaleout queue length performance counter.","Ensure the backplane has sufficient capacity (Redis cluster, SQL tier, etc.).","Implement client-side throttling to prevent overwhelming the backplane."],"tags":["scaleout","backplane","backpressure","signalr","queue","configuration"],"backgroundTag":null,"analyzedSha":"693053b89a9e1f5ce819e3233ed159a6409de22b","analyzedAt":"2026-08-13T22:23:59.793Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}