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

New timeout handling to fix issue #52 #86

Merged
merged 3 commits into from
May 3, 2016
Merged

New timeout handling to fix issue #52 #86

merged 3 commits into from
May 3, 2016

Conversation

dterei
Copy link
Collaborator

@dterei dterei commented Apr 30, 2016

Few different people reported issue #52, this commit fixes it.

Basically what would occur is if you ran the following:

for (i = 0; i < 20; i++) {
    mc.set('key', 'value');
}

You'd get an exception as Node doesn't like you creating more than 11 timeouts by default, and we'd try to create 20. We could increase the number of timeouts allowed (to infinite), but this design seems nicer, to just use one timeout and track deadlines in a queue.

We also bump to version 0.9.2.

We move to a new (yet again!) timeout handling system where we only use
one active timer at a time, and track future timeouts / deadlines in our
own queue to re-arm the timer.

This fixes issue #52.

We could use `setMaxListeners` to instead increase the timeout handlers
allowed and keep with the existing design, but this approach is O(1)
scalable.
@alevy
Copy link
Member

alevy commented May 2, 2016

This seems fine, but because it changes a pretty core part of the request handling, maybe it's best to bump to 0.10 instead?
It looks pretty solid and seems well tested, but the current timeout handling was the result of some pretty gnarly edge cases that came up in deployment.

@dterei
Copy link
Collaborator Author

dterei commented May 3, 2016

Sure, happy to bump to 0.10.

@alevy alevy merged commit f82d129 into memcachier:master May 3, 2016
alloy added a commit to artsy/metaphysics that referenced this pull request Jan 20, 2017
The version we were using had an issue where too many timeout handlers
were being defined: memcachier/memjs#86.

This lead to many warnings like the following in the production logs:

    (node:9852) Warning: Possible EventEmitter memory leak detected.
    11 timeout listeners added. Use emitter.setMaxListeners() to
    increase limit

The logs also show many `ECONNRESET` and similar errors, which may be
related to this: memcachier/memjs#89. According to
that thread, however, it seems like version 0.10.0 could also be
suffering from issues, although others report it working for them.
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