-
Notifications
You must be signed in to change notification settings - Fork 52
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
Read/write out-of-order bug? #20
Comments
Interesting. OK. This is solvable by using the opaque field in the header. I'll get to it. |
Aha! The problem is not with memcached responding out of order, but rather with memjs requesting out of order. What's going on is that since the there is no connection yet (it's established lazily), the first operation (after enqueing the response and error) blocks on the connection to be established. Meanwhile, Nesting both operations within a higher level operation solves this:
In principal, opaque would solve this, but it turns out to be kind of a messy solution that I'd like to avoid if we can rely on ordering. I think this is more easily fixable by mucking with the connection code a bit (specifically sticking requests in a common buffer that's flushed upon the first request that sees a connected socket). Thanks for finding this! It's a kind of subtle one, but very bad and important to fix. |
Ah yes, I guess memcached physically can't respond out of order, so it can't be a problem with out of order responses. And whilst memjs might use multiple memcached servers, each of them will have a separate queue, so any queue-based fix should work for them all. Thanks for looking at this. Look forward to the fix! |
@alevy Is this being worked on? Do you have any sort of idea how long it might take? |
@ithinkihaveacat thanks for the nudge. My original (to actually write to the socket lazily) turned out to be complicated, but I did something dumber, but that I'm pretty sure works and is fairly clean. Check out the lazyconn branch or pull request #22. If you can give this a test before i merge that would be awesome! |
Thanks! I had a bit of a quick test tonight, and it seems okay so far. |
Looks good to me! Thanks! |
There seems to be a problem with memjs not receiving responses from a (local) memcached server in the order in which they are sent. This can mean that the response to a GET can be confused with the response to a SET, and vice versa.
The
read-write-ordering-bug
branch of https://github.com/ithinkihaveacat/memjs/tree/read-write-ordering-bug illustrates this problem.The output shows:
I've reproduced this bug on both OS X (node 0.8.18, memcached 1.4.5) and Linux (node 0.8.18, memcached 1.4.7).
I'm a bit surprised no-one else has noticed this! Is everyone else using MemCachier, which doesn't respond out-of-order?
The text was updated successfully, but these errors were encountered: