Repository navigation
Conversation
…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>
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.
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. New requests on an 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.New mock server tests
Zookeeper_multiFailureand real server testZookeeper_multi::testCreateContainercover these cases.