{"record":{"id":"80f9aa5943b7718b","repo":"microsoft/FASTER","slug":"the-inner-list-is-full","errorCode":null,"errorMessage":"The inner list is full!","messagePattern":"The inner list is full!","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"cs/remote/src/FASTER.common/ElasticCircularBuffer.cs","lineNumber":48,"sourceCode":"        }\n\n        public T PeekFirst()\n        {\n            return Items[head];\n        }\n\n        public T PeekLast()\n        {\n            return Items[(tail - 1) & DefaultCapacity];\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void Enqueue(ref T value)\n        {\n            int next = (tail + 1) & DefaultCapacity;\n            if (next == head)\n            {\n                throw new InvalidOperationException(\"The inner list is full!\");\n            }\n            Items[tail] = value;\n            tail = next;\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public T Dequeue()\n        {\n            if (head == tail)\n            {\n                throw new InvalidOperationException(\"The list is empty!\");\n            }\n            int oldhead = head;\n            head = (head + 1) & DefaultCapacity;\n            var ret = Items[oldhead];\n            Items[oldhead] = default;\n            return ret;\n        }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cs/remote/src/FASTER.common/ElasticCircularBuffer.cs#L30-L66","documentation":"The single ElasticCircularBuffer (fixed DefaultCapacity-sized ring) Enqueue found the ring full: advancing tail would collide with head. The buffer is a fixed-size power-of-two ring, so callers must ensure capacity before enqueueing or use the elastic (multi-buffer) variant; otherwise the enqueue is rejected with InvalidOperationException.","triggerScenarios":"Calling Enqueue on a single-buffer ElasticCircularBuffer already containing DefaultCapacity items — producers outpacing consumers with no capacity check.","commonSituations":"Burst traffic where the consumer (e.g., network writer) stalls; sizing DefaultCapacity too small for in-flight messages; forgetting to check IsFull before enqueue in a tight producer loop.","solutions":["Increase DefaultCapacity (it is a power-of-two mask, so use 2^n sizing) to accommodate peak in-flight items.","Check IsFull before Enqueue and block/drop/backpressure the producer accordingly.","Ensure the consumer is running and not stuck; drain faster than production in steady state.","Use the elastic (multi-buffer) constructor so new segments are allocated on overflow instead of throwing."],"exampleFix":"// before\nqueue.Enqueue(ref item);\n\n// after\nif (queue.IsFull())\n{\n    // apply backpressure or grow capacity\n}\nelse\n{\n    queue.Enqueue(ref item);\n}","handlingStrategy":"validation","validationCode":"// check capacity before producing\nif (queue.IsFull())\n{\n    // apply backpressure, drop, or grow capacity\n}\nelse\n{\n    queue.Enqueue(ref item);\n}","typeGuard":null,"tryCatchPattern":"try { queue.Enqueue(ref item); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"full\"))\n{\n    // backpressure: wait for the consumer to drain, then retry\n    await consumerDrainedTask; queue.Enqueue(ref item);\n}","preventionTips":["Size the ring as a power of two with headroom for peak bursts.","Check IsFull before every enqueue in producer loops.","Monitor consumer lag and alert before capacity is exhausted.","Prefer the elastic constructor when the producer rate is unbounded."],"tags":["csharp","buffer","capacity","faster"],"backgroundTag":"internal-invariant-violation","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}