Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent multiget socket corruption - fixes #956 #957

Conversation

cornu-ammonis
Copy link

See #956.

The key idea is to treat the entire series of write and read ops as a single "request" for the connection; because if we start the getkq write ops but do not read the results off the socket, the socket is left in an invalid state.

To test this locally in Rails Console I used the snippets referenced in the issue to contrive a timeout error. If you agree with this approach I'd be happy to work out how to test this in specs.

Currently there is a race condition: if something happens between make_getkq_requests and finish_queries, the getkq request responses will be written to the socket, but the sockets @request_in_progress flag will not be set. This means that future gets may read corrupted/incorrect socket data.

Instead we should conceive of the "request" as starting as soon as we go to write the getkq to the servers. Therefore we should verify the op and mark start_request! prior to sending the getkq ops.
so we can start_request! before get_multi's write operations
@petergoldstein
Copy link
Owner

See my notes on #956. Barring an updated example of the issue, I'll plan to close this in a couple of days.

@petergoldstein
Copy link
Owner

This represents a misunderstanding of the underlying code. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants