microsoft/FASTER · error · Exception

Pending reads not supported with pub/sub

Error message

Pending reads not supported with pub/sub

What it means

WebsocketServerSession (the pub/sub websocket backend) throws the same error as the binary pub/sub path: reads that complete with Pending status cannot be handled by the pub/sub reply logic. The websocket Publish path serializes exactly one reply batch and has no machinery to track/resume pending read completions, so a pending read is an unsupported operation.

Solutions

  1. Restrict websocket pub/sub sessions to Publish/Subscribe traffic; issue reads against store-backed sessions only.
  2. Switch the client to a regular (non-pub/sub) wire-format session if reads are required.
  3. Adjust read issuance (drop ReadOptions that make reads pend) or use subscribe-based data delivery instead.

Example fix

// before
wsClient.Read(key); // pub/sub websocket session -> pending read
// after
wsClient.Subscribe(keyPrefix); // receive data via subscription
Defensive patterns

Strategy: validation

Validate before calling

// before opening the websocket session, ensure reads go to a store-backed session
bool isPubSubSession = sessionProvider is PubSubSessionProvider;
if (isPubSubSession && issuesReads) throw new InvalidOperationException("Configure reads on a non-pub/sub session");

Try / catch

try { wsClient.Read(key); } catch (Exception) { /* route reads to a store-backed session */ }

Prevention

When it happens

Trigger: A websocket client sends a ReadRequest (or read with ReadOptions that defers completion) to a session backed by the pub/sub provider, and the read returns status Pending in WebsocketServerSession's Publish processing loop.

Common situations: Using the websocket FASTER server with the pub/sub subsystem while a client library issues normal reads; porting a client from a store-backed session to a pub/sub session without changing read usage.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of microsoft/FASTER@321d872eab (2026-09-15). Data as JSON: /api/errors/2df46395cec7f907. Report an issue: GitHub.

Appendix: source

Thrown at cs/remote/src/FASTER.server/WebsocketServerSession.cs:600

            if (!status.IsPending)
            {
                // Write six bytes (message | status | sid)
                hrw.Write(message, ref dcurr, (int)(dend - dcurr));
                Write(ref status, ref dcurr, (int)(dend - dcurr));
                Write(sid, ref dcurr, (int)(dend - dcurr));
                if (prefix)
                    serializer.Write(ref key, ref dcurr, (int)(dend - dcurr));
                if (valPtr != null)
                {
                    ref Value value = ref serializer.ReadValueByRef(ref valPtr);
                    serializer.Write(ref value, ref dcurr, (int)(dend - dcurr));
                }
                else if (status.Found)
                    serializer.SkipOutput(ref dcurr);
            }
            else
            {
                throw new Exception("Pending reads not supported with pub/sub");
            }

            // Send replies
            var dtemp = d + 10;
            var dstart = dtemp + sizeof(int);
            Unsafe.AsRef<BatchHeader>(dstart).NumMessages = 1;
            Unsafe.AsRef<BatchHeader>(dstart).SeqNo = 0;
            int packetLen = (int)((dcurr - 10) - d);

            CreateSendPacketHeader(ref d, packetLen);

            *(int*)dtemp = (packetLen - sizeof(int));
            networkSender.SendResponse((int) (d - networkSender.GetResponseObjectHead()), (int)(dcurr - d));
        }


        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        private static unsafe bool WriteOpSeqId(ref int o, ref byte* dst, int length)

View on GitHub (pinned to 321d872eab)