Comments (7)
@mjq do you have any sample code that reproduces this? thats the best place to start for a test
from follow.
Sorry, sure. Simplified, it's:
var follow = require('follow');
var db = '...';
var feed = new follow.Feed({db: db, include_docs: true});
feed.on('change', function(change) {
console.log('got change %d', change.seq);
});
feed.on('error', function(err) {
console.log('got error %s, restarting in 5s', err.message);
setTimeout(function() {
console.log('restarting');
feed.restart();
}, 5000);
});
feed.start();
Normally, the logs would look like
got change 5
got change 6
got change 7
But, if the first attempt to reach the database times out but responds shortly after, you'll see
got error "Timeout confirming database: <db name>", restarting in 5s
restarting
got change 5
got change 5
got change 6
got change 6
got change 7
got change 7
from follow.
@mjq this is fascinating, I've never seen this happen. Destroy_req, should be called by the die function but it seems like there is a race condition leaving two requests? Ill have to dig deeper on this when i have a minute
from follow.
@jcrugzz die
destroys self.pending.request
, but the request in confirm is a local variable, so if it isn't destroyed in confirm
, nothing will (or so it seems to me).
A simpler bug to test, repro and fix may just be:
- request in
confirm
takes longer than the timeout, but db_response
is called anyway (even though the timeout killed the feed).
Since db_response only applies to the success case, that alone is weird/wrong behaviour, and just by fixing that (by e.g. destroying the request in the timeout fn), it should prevent the double-listener stuff.
re: race conditions: We've got a single process simultaneously following an ever-changing set of a few thousand databases (with all those databases on the same CouchDB box). So, when requests to that box start stalling... well, if there's a race condition to be found, we'll find it, heh.
I'm giving this patch a trial by fire right now, but I don't know how long it will take for us to trigger the bug again.
from follow.
@mjq gotcha, this is before it is piped into the changes-stream. Let me know if you can reproduce that but that looks like a valid fix. Super edge case but I can see the potential for it happening.
from follow.
@mjq @jcrugzz Are you going to fix this?
from follow.
+1 - This is still an issue
from follow.
Related Issues (20)
- Basic auth on db_follow fails with Error: getaddrinfo ENOTFOUND
- Auto-scalling multiple instances HOT 2
- Update engines directive in package.json
- `follow` does not follow `skimdb.npmjs.com` to the end HOT 3
- Tests do not pass with node v4.2.6 (stable) and v5
- question: How I can recieve `change` with previous revision of doc? HOT 3
- Database deleted after change
- process crash when using pause() resume() for large database HOT 5
- Use cookie auth with nano and follow HOT 1
- Abandoned? HOT 5
- follow uses older version of 'request' that has a security vulnerability
- How to write mocha unit testcase for db.follow()
- `request` dependency version.
- how to work with self-signed certificates HOT 1
- Specifiying an inexistent filter fails silently
- How many DBs can follow? HOT 2
- Question: how many feed instance can be create?
- Hangs and never resumes
- Support for _selector filter? HOT 1
- it works on local couchdb but not on the remote couchdb HOT 1
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 follow.