fix(q): harden response handling and encode dict results - #5
Open
belowzeroff wants to merge 3 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
q_exchangeRAY_DICTresults as QXDdictionaries::, wire type101 0) as Rayforce nullSIGPIPEon client sends so closed peers return a normal send errorRAY_ERRORobjects withray_error_freeon decode/server cleanup pathsUser-visible bugs
A user querying the Rayfall-over-Q server could return ordinary scalar, vector, table, and error values successfully, but a query whose result was a native Rayforce dictionary failed at the Q wire boundary. From the user side this looks like a transport/server response failure instead of receiving the expected dictionary value.
Example shape:
.q.send h "(dict [a b] [1 2])"Expected: the client receives the dictionary result.
Before this fix: the server could not serialize the native
RAY_DICTresult becauseq.conly decoded dictionaries and did not encode them, so the request failed when the response was being prepared.A real q server can also return identity/null (
::). Before this fix,.q.send h "::"reached the client as wire type101 0, butq_decodedid not handle that type and surfaced an unsupported-wire-type failure instead of a null result.If the remote peer closed the socket before
.q.sendwrote the request, the POSIXsend(..., 0)path could raiseSIGPIPEand terminate the embedding process. The client send helper now usesMSG_NOSIGNALwhere available andSO_NOSIGPIPEwhere supported, so closed peers fail cleanly as send errors.The branch also keeps the earlier response-frame hardening: if a peer sends a sync/request frame where the client is waiting for a response,
.q.sendnow fails clearly with an expected response message type error instead of decoding the wrong frame shape.Tests
make recheck