{"action":"opened","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-listener/issues/62","repository_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-listener","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-listener/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-listener/issues/62/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-listener/issues/62/events","html_url":"https://github.com/couchbase/couchbase-lite-java-listener/issues/62","id":131461717,"number":62,"title":"Simultaneous requests can sometimes lock the listener","user":{"login":"jamiltz","id":2589337,"avatar_url":"https://avatars.githubusercontent.com/u/2589337?v=3","gravatar_id":"","url":"https://api.github.com/users/jamiltz","html_url":"https://github.com/jamiltz","followers_url":"https://api.github.com/users/jamiltz/followers","following_url":"https://api.github.com/users/jamiltz/following{/other_user}","gists_url":"https://api.github.com/users/jamiltz/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiltz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiltz/subscriptions","organizations_url":"https://api.github.com/users/jamiltz/orgs","repos_url":"https://api.github.com/users/jamiltz/repos","events_url":"https://api.github.com/users/jamiltz/events{/privacy}","received_events_url":"https://api.github.com/users/jamiltz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-04T20:15:32Z","updated_at":"2016-02-04T20:15:32Z","closed_at":null,"body":"It's a difficult issue to reproduce and I haven't been able to make a sample project to help find what's causing it.\r\n\r\nIt was tested with SQLite storage type and CBL Android 1.2.0-26. \r\n\r\nHowever, the zip file at http://cl.ly/0s3a3i3d3C1A contains:\r\n\r\n- A screenshot of the Network debugging tab in Chrome when the issue starts happening. A lot of requests are in a pending state.\r\n- Multiple thread dumps.\r\n\r\nThe same test was done by replacing the filter on the changes feed requests (for example, `/_changes?filter=orders/order...`) with requests to the view endpoints (for example `/_design/orders/_view/order`) and the issue remains.\r\n\r\nIs there something that could cause the Listener to have multiple requests pending? What happens if multiple requests hit _changes at the same time? If part of the code is not thread safe and each request creates a new thread, could it then be in a locked state?\r\n\r\nThis locked state could be reproduced most of the time when the replication between devices was interrupted. When the replication resumed, the pending requests returned 200 and the application resumed. I'm wondering if the replications resuming could have an impact in triggering the pending requests to return."}}