{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3961","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3961/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3961/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3961/events","html_url":"https://github.com/pouchdb/pouchdb/issues/3961","id":87942569,"number":3961,"title":"Attachments loss","user":{"login":"ermouth","id":1540047,"avatar_url":"https://avatars.githubusercontent.com/u/1540047?v=3","gravatar_id":"","url":"https://api.github.com/users/ermouth","html_url":"https://github.com/ermouth","followers_url":"https://api.github.com/users/ermouth/followers","following_url":"https://api.github.com/users/ermouth/following{/other_user}","gists_url":"https://api.github.com/users/ermouth/gists{/gist_id}","starred_url":"https://api.github.com/users/ermouth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ermouth/subscriptions","organizations_url":"https://api.github.com/users/ermouth/orgs","repos_url":"https://api.github.com/users/ermouth/repos","events_url":"https://api.github.com/users/ermouth/events{/privacy}","received_events_url":"https://api.github.com/users/ermouth/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":19,"created_at":"2015-06-13T06:08:28Z","updated_at":"2015-06-15T21:32:13Z","closed_at":null,"body":"On https://github.com/pouchdb/pouchdb/issues/3932, https://github.com/pouchdb/pouchdb/issues/3942.\r\n\r\n__UPD. Disregard the post__, both fix and reason seem to be invalid :( More info in comments.\r\n\r\nSeems that issue takes place in, at least, 3.2.1 and 3.3.1 and, possibly, 3.6.0 (did not test) because:\r\n* timeout in ajax module is too short (1e4 hardcoded, smth around 1e6 look more reasonable)\r\n* remote DB can have several docs with large atts (tens of megabytes) and fetching them induces timeout\r\n* this case is somehow incorrectly handled\r\n* doc is saved with original md5, but zero-length attachment(s).\r\n\r\nIf all above is correct it seems that Pouch never checks if attachment received from remote source is consistent to its digest.\r\n\r\nAs for 3.2.1 there was enough to increase timeout. For general fix I think it‘s reasonable to re-hash received data and revisit timeout handler.\r\n\r\nAlso this case shows why browser tests with CouchDB on `localhost` better be avoided. Virtual loop in general has much wider bandwidth capacity than any real end-user network.\r\n\r\nI can reproduce it in all browsers with remote DB that contains several docs with large attachments. Please let me know if you also can. No code example since case is very specific to network conditions and DB, sorry.\r\n\r\nSeems that https://github.com/pouchdb/pouchdb/issues/3932 could not be reproduced, even repeating steps provided exactly, because my remote DB had several large docs and my network is nearly always very busy.\r\n\r\nTo note – general practice to avoid this kind of issues is to have a test for each numeric constant inside the code, as well as for assumption under each particular constant."},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/112217679","html_url":"https://github.com/pouchdb/pouchdb/issues/3961#issuecomment-112217679","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/3961","id":112217679,"user":{"login":"ermouth","id":1540047,"avatar_url":"https://avatars.githubusercontent.com/u/1540047?v=3","gravatar_id":"","url":"https://api.github.com/users/ermouth","html_url":"https://github.com/ermouth","followers_url":"https://api.github.com/users/ermouth/followers","following_url":"https://api.github.com/users/ermouth/following{/other_user}","gists_url":"https://api.github.com/users/ermouth/gists{/gist_id}","starred_url":"https://api.github.com/users/ermouth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ermouth/subscriptions","organizations_url":"https://api.github.com/users/ermouth/orgs","repos_url":"https://api.github.com/users/ermouth/repos","events_url":"https://api.github.com/users/ermouth/events{/privacy}","received_events_url":"https://api.github.com/users/ermouth/received_events","type":"User","site_admin":false},"created_at":"2015-06-15T21:32:13Z","updated_at":"2015-06-15T21:32:13Z","body":"@daleharvey I see this sympthom not only for cloudwall.me domain, but also for the domain where I have main working set. So I‘ll try tomorrow to wipe out everything local related to cloudwall.me.\r\n\r\n> can you continually run that test and see the failing condition?\r\n\r\nI‘ve tried many times, result is always the same, without exeption. Can even share screen via skype to let you see how it looks like.\r\n\r\nSo now I definitely need to sort out IDB as a reason. What the heck is the reason? What else can be the reason?"}}