{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3550","repository_url":"https://api.github.com/repos/pouchdb/pouchdb","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3550/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3550/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3550/events","html_url":"https://github.com/pouchdb/pouchdb/issues/3550","id":58192760,"number":3550,"title":"HTTP+filtered changes fails with ESOCKETTIMEDOUT on large CouchDB changeset","user":{"login":"shimaore","id":55340,"avatar_url":"https://avatars.githubusercontent.com/u/55340?v=3","gravatar_id":"","url":"https://api.github.com/users/shimaore","html_url":"https://github.com/shimaore","followers_url":"https://api.github.com/users/shimaore/followers","following_url":"https://api.github.com/users/shimaore/following{/other_user}","gists_url":"https://api.github.com/users/shimaore/gists{/gist_id}","starred_url":"https://api.github.com/users/shimaore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shimaore/subscriptions","organizations_url":"https://api.github.com/users/shimaore/orgs","repos_url":"https://api.github.com/users/shimaore/repos","events_url":"https://api.github.com/users/shimaore/events{/privacy}","received_events_url":"https://api.github.com/users/shimaore/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2015-02-19T10:50:36Z","updated_at":"2016-02-05T15:33:04Z","closed_at":"2015-02-19T18:51:24Z","body":"If CouchDB contains a large changeset (in my case, 170K+ deletions), filtered replication will take some time to process in CouchDB (which is OK), but PouchDB's `.changes` will fail with an `ESOCKETTIMEDOUT` error:\r\n\r\n    $ node -e 'P = require(\"pouchdb\"); db = new P(\"http://127.0.0.1:5984/provisioning\"); db.changes({include_docs:true,filter:\"royal-thing/global_numbers\",since:1897043}).on(\"error\",function(error){console.log(error.toString());});'\r\n    Error: ESOCKETTIMEDOUT\r\n\r\nThis is repeatable; the error shows up 31 seconds after the start of the request.\r\n(This is PouchDB 3.3.1 against CouchDB 1.4.0. `since` in the query is at 1897043, while the `update_seq` of the database is 2020286. CouchDB logs show it running the filter.)\r\n\r\nDoing a plain `curl` at the command prompt with the same parameters as the PouchDB request, `curl` just waits for the data to come in:\r\n\r\n    $ curl 'http://127.0.0.1:5984/provisioning/_changes?timeout=25000&include_docs=true&feed=longpoll&filter=royal-thing/global_numbers&since=1897043&limit=25'\r\n    {\"results\":[\r\n\r\nI tried playing with `ajax.timeout` since this is the only timer available, but unsurprisingly it doesn't affect the outcome, since the TCP connection is established (there's no timeout at the network level).\r\n\r\nNote: this might be related to the second problem described in #3210"},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/180403339","html_url":"https://github.com/pouchdb/pouchdb/issues/3550#issuecomment-180403339","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3550","id":180403339,"user":{"login":"ronyrun","id":7273443,"avatar_url":"https://avatars.githubusercontent.com/u/7273443?v=3","gravatar_id":"","url":"https://api.github.com/users/ronyrun","html_url":"https://github.com/ronyrun","followers_url":"https://api.github.com/users/ronyrun/followers","following_url":"https://api.github.com/users/ronyrun/following{/other_user}","gists_url":"https://api.github.com/users/ronyrun/gists{/gist_id}","starred_url":"https://api.github.com/users/ronyrun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ronyrun/subscriptions","organizations_url":"https://api.github.com/users/ronyrun/orgs","repos_url":"https://api.github.com/users/ronyrun/repos","events_url":"https://api.github.com/users/ronyrun/events{/privacy}","received_events_url":"https://api.github.com/users/ronyrun/received_events","type":"User","site_admin":false},"created_at":"2016-02-05T15:33:04Z","updated_at":"2016-02-05T15:33:04Z","body":"Hi, I have the same error with the last Version.\r\n\r\n\r\n```\r\nUnhandled rejection Error: ETIMEDOUT\r\nat onError (/MyApp/node_modules/pouchdb/lib/index.js:425:18)\r\nat Request._callback (/MyApp/node_modules/pouchdb/lib/index.js:463:14)\r\nat self.callback (/MyApp/node_modules/pouchdb/node_modules/request/request.js:198:22)\r\nat Request.emit (events.js:107:17)\r\nat null._onTimeout (/MyApp/node_modules/pouchdb/node_modules/request/request.js:764:12)\r\nat Timer.listOnTimeout (timers.js:119:15)\r\n```\r\n\r\nHere is my config : \r\n\r\n```javascript\r\n\r\n  var options = {\r\n                continuous: true,\r\n                live: true,\r\n                since: 0,\r\n                include_docs: true,\r\n                batch_size : 1000,\r\n                filter : 'globalFilter/demandesToBackend'\r\n            };\r\n\r\ndb.changes(options)\r\n                .on('change', function (change) {\r\n                    logger.info('demande occured ', change);\r\n                })\r\n                .on('error', function(e){\r\n                    logger.error(\"error in globalRemoteDB.changes : \",e);\r\n                    self.change = null;\r\n                    reject(e);\r\n                });\r\n\r\n```"}}