Comments (7)
Interesting. OK. This is solvable by using the opaque field in the header. I'll get to it.
from memjs.
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, example.js
continues on it's merry way and performs the second operation. Now the connection has been set, so it immediately proceeds to write the request to the socket. Only now do we switch back to the first operation. So the requests are sent out of order.
Nesting both operations within a higher level operation solves this:
client.get('dummy', function() {
client.get('AAA');
client.set('BBB', 'ZZZ');
client.close(); // close really needs to be nested to ensure ordering, but at least on localhost this happens to work
});
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.
from memjs.
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!
from memjs.
@alevy Is this being worked on? Do you have any sort of idea how long it might take?
from memjs.
@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!
from memjs.
Thanks! I had a bit of a quick test tonight, and it seems okay so far.
from memjs.
Looks good to me! Thanks!
from memjs.
Related Issues (20)
- timeout but failed to retry until restarting program HOT 28
- Is it possible to use from the browser? HOT 1
- Operation timeouts do not work as expected HOT 3
- How to clear memcached server from nodejs? HOT 2
- Denial of Service vulnerability HOT 1
- memJS terminates connection to coherence HOT 1
- Feature: Key wrapper
- Get without callback returns incorrect signature HOT 2
- Possibility to get all errors from server
- Do we have option to use limit and offset HOT 1
- Application exits if memcached server restarts HOT 1
- Can we delete many keys? HOT 1
- unix socket support HOT 1
- MCRouter issue HOT 3
- Add node autodiscovery HOT 1
- TLS support for memjs
- Sporadic bursts of error: socket timed out waiting on response
- Trying an operation after calling `.quit()` doesn't trigger any errors HOT 3
- Possible bug in signature check HOT 2
- Possible support for ASCII protocol? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memjs.