{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4604","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4604/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4604/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4604/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4604","id":118677188,"number":4604,"title":"PouchDB client is going in loop when change feed is asking for changes with syncgw.","user":{"login":"sudhanitk","id":15979814,"avatar_url":"https://avatars.githubusercontent.com/u/15979814?v=3","gravatar_id":"","url":"https://api.github.com/users/sudhanitk","html_url":"https://github.com/sudhanitk","followers_url":"https://api.github.com/users/sudhanitk/followers","following_url":"https://api.github.com/users/sudhanitk/following{/other_user}","gists_url":"https://api.github.com/users/sudhanitk/gists{/gist_id}","starred_url":"https://api.github.com/users/sudhanitk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sudhanitk/subscriptions","organizations_url":"https://api.github.com/users/sudhanitk/orgs","repos_url":"https://api.github.com/users/sudhanitk/repos","events_url":"https://api.github.com/users/sudhanitk/events{/privacy}","received_events_url":"https://api.github.com/users/sudhanitk/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-24T18:45:27Z","updated_at":"2015-11-25T12:53:54Z","closed_at":null,"body":"SyncGW Release version: 1.1.1-10\r\nCouchbase Release version: 4.0.0-4047\r\nPouchDB version: pouchdb-5.0.0\r\n1) Client requests the list of docs “since=0”.\r\npouchdb:http GET http://1.2.3.4:8080/pttdata/_changes?timeout=25000&style=all_docs&since=0&limit=100 +2ms\r\nSEC7118: XMLHttpRequest for http://1.2.3.4:8080/pttdata/_changes?timeout=25000&style=all_docs&since=0&limit=100&_nonce=1447414039671 required Cross Origin Resource Sharing (CORS).\r\n2) Sync GW responds with list of changes and last_seq as “231427::231614”\r\n\r\n3) Client requests again with the last seq number \r\n\r\nGET\r\npouchdb:http GET http://1.2.3.4:8080/pttdata/_changes?timeout=25000&style=all_docs&since=231427%3A%3A231614&limit=100 +3ms\r\nSEC7118: XMLHttpRequest for http://1.2.3.4:8080/pttdata/_changes?timeout=25000&style=all_docs&since=231427%3A%3A231614&limit=100&_nonce=1447414039770 required Cross Origin Resource Sharing (CORS).\r\nFile: WebDispatcher\r\nSEC7119: XMLHttpRequest for http://1.2.3.4:8080/pttdata/_changes?timeout=25000&style=all_docs&since=231427%3A%3A231614&limit=100&_nonce=1447414039770 required CORS preflight.\r\n\r\nSync GW responds with list of changes and last_seq as “231427::231614”\r\n200 OK Response\r\n\r\nSync Gw logs as below\r\n 2015-11-22T23:26:54.195-06:00 HTTP: #523919: GET /pttdata/_changes?timeout=25000&style=all_docs&since=231427%3A%3A231614&limit=100&_nonce=1448256410641 (as 919591803633)\r\n 2015-11-22T23:26:54.195-06:00 Changes: MultiChangesFeed({*}, {Since:231427::231614 Limit:100 Conflicts:true IncludeDocs:false Wait:false Continuous:false Terminator:0xc217607ce0 HeartbeatMs:0 TimeoutMs:25000}) ... (to 919591803633)\r\n\r\n4) With the last_seq in (3), client is in loop requesting GET similar to (3). \r\n\r\nis last_seq “231427::231614” is causing PouchDB to go in loop? \r\nhow to avoid this kind of infinite loops?\r\n\r\nLogs are attached in https://gist.github.com/anonymous/39408c5635dfc25bb95e "},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/159599444","html_url":"https://github.com/pouchdb/pouchdb/issues/4604#issuecomment-159599444","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4604","id":159599444,"user":{"login":"willholley","id":97787,"avatar_url":"https://avatars.githubusercontent.com/u/97787?v=3","gravatar_id":"","url":"https://api.github.com/users/willholley","html_url":"https://github.com/willholley","followers_url":"https://api.github.com/users/willholley/followers","following_url":"https://api.github.com/users/willholley/following{/other_user}","gists_url":"https://api.github.com/users/willholley/gists{/gist_id}","starred_url":"https://api.github.com/users/willholley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willholley/subscriptions","organizations_url":"https://api.github.com/users/willholley/orgs","repos_url":"https://api.github.com/users/willholley/repos","events_url":"https://api.github.com/users/willholley/events{/privacy}","received_events_url":"https://api.github.com/users/willholley/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T12:53:54Z","updated_at":"2015-11-25T12:53:54Z","body":"Are you saying that the response from CSG in (3) returns a last_seq of 231427::231614 (i.e. the same as was passed to since)? If the response contains changes then the last_seq should change, else a loop will indeed be generated between PouchDB and CSG.\r\n\r\nIf not, are you able to provide a HAR / network trace of the interaction?"}}