Repository navigation
Conversation
|
AI-assisted review on behalf of @anmolnar Thanks for this. I traced each fix against A few points, none blocking:
|
…zed, desync on container creates, abort on header-only errors, and hang on dead handles Fix a group of related defects in the C client multi-op path: - Synchronous zoo_multi() failures left the err fields of zoo_op_result_t uninitialized. Fill every result slot with the failure code when the multi fails at call time (validation, send failure, closed or unrecoverable handle) and when a pending multi is drained on connection loss or session expiry. - A container create inside a multi gets a Create2Response (path and stat). The client decoded it as a CreateResponse, which left the stat in the stream and misaligned all following sub-results. Decode the record by its wire type. - A multi reply with an error in its header (for example ZNOTREADONLY) has no body. The synchronous path tried to decode it and hit assert(entry). Fail every sub-operation with the header error instead. Treat replies with more or fewer sub-results than operations as ZMARSHALLINGERROR instead of crashing. - do_add_completion() queued requests on an unrecoverable handle, where no teardown drains them. A synchronous caller, for example a zero-count zoo_multi() on an expired session, waited forever. Refuse the request instead. - zoo_amulti() dereferenced NULL ops or results arrays. Return ZBADARGUMENTS. Add Zookeeper_multiFailure mock-server tests and a real-server Zookeeper_multi::testCreateContainer test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r reply mismatches Address review feedback: - Return ZBADARGUMENTS, ZINVALIDSTATE, and ZSYSTEMERROR from zoo_amulti as themselves. A serializer error still gives ZMARSHALLINGERROR. The tests now assert the exact code. - Add mock tests for a reply with more results than operations, for a reply with fewer results, and for an async container create. - Correct the deserialize_multi comment about record formats. - Document in zookeeper.h the return codes of zoo_amulti, and that every result slot is filled on failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cafc727 to
3606a01
Compare
|
Reply from Claude Code (an AI assistant), on behalf of @apurtell. @anmolnar Thanks for the review. Addressed in 3606a01:
With this, the multi test in #2499 can assert All C client tests pass on Linux with OpenSSL 3.2+, when #2510 is applied for the test certificates. |
The C client's multi() path has several related defects.
When a synchronous
zoo_multi()call fails, theerrfields of thezoo_op_result_tarray stay uninitialized, so an application might mistake a failed sub-operation as a success.NULLops or results arrays will crash the client instead of returning an error. On an expired or unrecoverable handle, the client still queues requests, so a synchronous call can block forever, for example a zero countzoo_multi().Inside a multi op handling the server answers a container create with a
Create2Response, which holds a path and a stat. However the client decodes it as aCreateResponsewhich doesn't know about the stat, so every result after it will be decoded in a misaligned manner, essentially reading garbage.The fix fills every result slot with the failure code on all failure paths, and returns
ZBADARGUMENTSfor NULL arrays. A multi that fails a call-time check returns that code, for exampleZBADARGUMENTSfor an invalid path orZINVALIDSTATEfor an expired handle, instead ofZMARSHALLINGERROR. New requests on a closing or unrecoverable handle are refused at once. Each sub-result is decoded correctly. A reply with more or fewer results than operations returnsZMARSHALLINGERRORinstead of crashing the application.Behaviour change outside multi: the refusal is in
do_add_completion, so it applies to every request. A synchronous call that races with session expiry no longer hangs, and an asynchronous call in that window fails at once instead of being queued.New mock server tests
Zookeeper_multiFailureand real server testZookeeper_multi::testCreateContainercover these cases.