Skip to content

1.x: REST request not reaching the couchbase lite java listener. #83

@NitzDKoder

Description

@NitzDKoder

Hi Folks,

1)App design similar to Couchbase-Lite-PhoneGap-Plugin
https://github.com/couchbaselabs/Couchbase-Lite-PhoneGap-Plugin

  1. App HTML/JS code does REST using -->>> modules.js(https request formation and timeouts) ---> Android Webview --->> couchbase lite java listener

https://github.com/couchbaselabs/TodoLite-PhoneGap/blob/f1a810f9408a9807f3bf25ae69ba1d6a6aaee71c/js/modules.js

3)Heartbeat for DB changes(_changes) is 5 mins.

  1. After idle the REST request from HTML/JS fails to get response from server.

Logs Analysis:

Success case:

App JS:

[08/28 17:40:08:006] [HTML5LOG] cblPtxInterface.syncManager()-> doCancelPost()-> Stop Sync = {"target":"ptxdata","source":{"url":"https://AAAAAAAAAAAA:XXXXXXXXXXXXXXXXX@mydomain/data"},"continuous":true,"filter":"sync_gateway/bychannel","query_params":{"channels":"PTX-919480109390-meta-CH,919480109390-CH"}}
[08/28 17:40:08:013] [HTML5LOG] ReSTCBL ::: Request started::{"id":"139: POST https://:@localdomain:14480/_replicate"}
[08/28 17:40:08:083] [HTML5LOG] ReSTCBL ::: Got response::{"id":"139: POST https://:@localdomain:14480/_replicate","status":200}

App Webview:

[08/28 17:40:08:019] WhitelistPlugin ---------- cblURL: https://:@localdomain:14480/
[08/28 17:40:08:020] WhitelistPlugin ---------- CBL URL allowed to Navigate -----

Couchbase Logs:

 [08/28 05:40:08.061] [4] Listener: [REQUEST] (Acme.Utils.ThreadPool(1)-PooledThread: Acme.Serve.Serve$ServeConnection@2116a1d0) POST: https://localdomain:14480/_replicate
[08/28 05:40:08.061] [4] Listener: authHeader is null
[08/28 05:40:08.062] [4] Listener: Not enforcing basic auth -- allowedCredentials null or empty
[08/28 05:40:08.062] [4] Listener: remoteURL() addr=localdomain
[08/28 05:40:08.064] [4] Database: getDatabase() com.couchbase.lite.Manager@1da33ad9 com.couchbase.lite.Database@37445c9e[/data/data/com.xxx.app/files/data.cblite2]
[08/28 05:40:08.068] [4] Sync: PullerInternal{https://---:---@mydomain/data, pull, 1856e} [fireTrigger()] => STOP_GRACEFUL
[08/28 05:40:08.069] [4] Listener: RouterCallbackBlock.onResponseReady() START
[08/28 05:40:08.069] [16] Sync: firing trigger: STOP_GRACEFUL
[08/28 05:40:08.070] [4] Listener: RouterCallbackBlock.onResponseReady() END
[08/28 05:40:08.072] [4] Listener: CountDownLatch.await() START
[08/28 05:40:08.072] [4] Listener: CountDownLatch.await() END

Failure case:

App JS:

Line 2050: [08/28 17:54:22:685] [HTML5LOG] ReSTCBL ::: Request started::{"id":"142: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2052: [08/28 17:59:22:697] [HTML5LOG] ReSTCBL ::: Request started::{"id":"143: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2054: [08/28 18:04:22:720] [HTML5LOG] ReSTCBL ::: Request started::{"id":"144: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2075: [08/28 18:08:24:393] [HTML5LOG] ReSTCBL ::: Request started::{"id":"145: POST https://:@localdomain:14480/_replicate"}
Line 2084:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2097:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2105:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2113:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2121:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2375: [08/28 18:09:22:718] [HTML5LOG] ReSTCBL ::: Request started::{"id":"146: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2423: [08/28 18:13:25:463] [HTML5LOG] ReSTCBL ::: Request started::{"id":"147: POST https://:@localdomain:14480/_replicate"}
Line 2425: [08/28 18:14:22:733] [HTML5LOG] ReSTCBL ::: Request started::{"id":"148: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2429:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2464: [08/28 18:18:26:561] [HTML5LOG] ReSTCBL ::: Request started::{"id":"149: POST https://:@localdomain:14480/_replicate"}
Line 2466: [08/28 18:19:22:744] [HTML5LOG] ReSTCBL ::: Request started::{"id":"150: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2469: [08/28 18:20:04:296] [HTML5LOG] ReSTCBL ::: Request started::{"id":"151: POST https://:@localdomain:14480/data/_compact"}
Line 2502: [08/28 18:23:27:621] [HTML5LOG] ReSTCBL ::: Request started::{"id":"152: POST https://:@localdomain:14480/_replicate"}
Line 2504: [08/28 18:24:22:756] [HTML5LOG] ReSTCBL ::: Request started::{"id":"153: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2516: [08/28 18:29:22:768] [HTML5LOG] ReSTCBL ::: Request started::{"id":"154: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2526: [08/28 18:33:06:878] [HTML5LOG] ReSTCBL ::: Request started::{"id":"155: GET https://:@localdomain:14480/_active_tasks"}
Line 2528: [08/28 18:34:22:768] [HTML5LOG] ReSTCBL ::: Request started::{"id":"156: GET https://:@localdomain:14480/data/_changes?since=97&include_docs=true&style=main_only&heartbeat=300000&feed=longpoll"}
Line 2549: [08/28 18:37:02:654] [HTML5LOG] ReSTCBL ::: Request started::{"id":"157: POST https://:@localdomain:14480/_replicate"}
Line 2553:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2566:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false
Line 2843: [08/28 18:37:28:147] [HTML5LOG] ReSTCBL ::: Request started::{"id":"158: GET https://:@localdomain:14480/data/s919480109390_ptx1503925648131_meta.doc"}
Line 2901:  History url = https://:@localdomain:14480/data/_design%2FgetHistory/_view/getHistory?key=%22tel%3A%2B919663733552%22&reduce=false&group=false

App Webview

Line 42946: [08/28 17:54:22:697] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43015: [08/28 17:59:22:710] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43090: [08/28 18:04:22:736] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43145: [08/28 18:08:24:400] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43158: [08/28 18:08:25:491] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43161: [08/28 18:08:27:061] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43164: [08/28 18:08:28:078] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43167: [08/28 18:08:29:073] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43170: [08/28 18:08:32:186] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43343: [08/28 18:09:22:721] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43427: [08/28 18:13:25:467] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43429: [08/28 18:14:22:744] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43432: [08/28 18:14:31:067] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43462: [08/28 18:18:26:572] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43464: [08/28 18:19:22:755] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43478: [08/28 18:20:04:301] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43552: [08/28 18:23:27:633] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43554: [08/28 18:24:22:763] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43585: [08/28 18:29:22:777] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43647: [08/28 18:33:06:890] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43676: [08/28 18:34:22:771] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43735: [08/28 18:37:02:657] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43738: [08/28 18:37:03:966] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43741: [08/28 18:37:05:674] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43830: [08/28 18:37:28:150] WhitelistPlugin ---------- CBL URL allowed to Navigate -----
Line 43856: [08/28 18:37:36:267] WhitelistPlugin ---------- CBL URL allowed to Navigate -----

3

Couchbase Logs:

Do not see any request hitting the server.

Detail Logs:

App JS:
https://gist.github.com/NitzDKoder/a4562f511329919caa44acbe5bee7d47

App Webview
https://gist.github.com/NitzDKoder/f2ceed30c41f6bfa8a2127bbbde06195

Couchbase Logs:
https://gist.github.com/NitzDKoder/d23918d3b9af9860ea4e6c0ccad2bc45

@hideki @pasin please share you thoughts..

Thanks
Nithin

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions