Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBLRemoteSession finishTasksAndInvalidate crash #1923

Closed
msanilkumar2020 opened this issue Oct 6, 2017 · 4 comments
Closed

CBLRemoteSession finishTasksAndInvalidate crash #1923

msanilkumar2020 opened this issue Oct 6, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@msanilkumar2020
Copy link

Hi,

We are testing continuous PTX messages with below operation

  • Network trasistion
  • Foreground background transition

Sometimes we observe below crash, attached console logs

2017-10-04 11:59:09.833717+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-POST http://lite.couchbase./_replicate + 267-byte body
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
Origin: file://
2017-10-04 11:59:09.835069+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:@syncqc11.hsqc.com/ptxdata] STARTING ...
2017-10-04 11:59:09.841883+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:
@syncqc11.hsqc.com/ptxdata]: Reachability state = <syncqc11.hsqc.com>:reachable (02), suspended=0
2017-10-04 11:59:09.842158+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:@syncqc11.hsqc.com/ptxdata]: Going online
2017-10-04 11:59:09.842575+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:
@syncqc11.hsqc.com/ptxdata] Progress: set active = 1
2017-10-04 11:59:09.844416+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-Added Authorization header for CBLPasswordAuthorizer[919999990011/]
2017-10-04 11:59:09.847401+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteJSONRequest[GET https://919999990011:@syncqc11.hsqc.com/ptxdata/_local/487a7d1f57a2ec840f11a305df8a2963627fc9f6]: Starting...
2017-10-04 11:59:09.848007+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=24 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Content-Type: application/json
2017-10-04 11:59:09.848604+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-POST http://lite.couchbase./_replicate + 176-byte body
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
Origin: file://
2017-10-04 11:59:09.848647+0530 AT&T EPTT[3684:1900940] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteSession starting CBLRemoteJSONRequest[GET https://919999990011:
@syncqc11.hsqc.com/ptxdata/_local/487a7d1f57a2ec840f11a305df8a2963627fc9f6]
2017-10-04 11:59:09.849294+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:@syncqc11.hsqc.com/ptxdata] STARTING ...
2017-10-04 11:59:09.865571+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:
@syncqc11.hsqc.com/ptxdata]: Reachability state = <syncqc11.hsqc.com>:reachable (02), suspended=0
2017-10-04 11:59:09.866024+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:@syncqc11.hsqc.com/ptxdata]: Going online
2017-10-04 11:59:09.866384+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:
@syncqc11.hsqc.com/ptxdata] Progress: set active = 1
2017-10-04 11:59:09.866691+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-Added Authorization header for CBLPasswordAuthorizer[919999990011/
]
2017-10-04 11:59:09.866927+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteJSONRequest[GET https://919999990011:@syncqc11.hsqc.com/ptxdata/_local/4d8aad54627dda98a3b609396c3947e85f7f8e95]: Starting...
2017-10-04 11:59:09.868902+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=24 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Content-Type: application/json
2017-10-04 11:59:09.874690+0530 AT&T EPTT[3684:1901029] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteSession starting CBLRemoteJSONRequest[GET https://919999990011:
@syncqc11.hsqc.com/ptxdata/_local/4d8aad54627dda98a3b609396c3947e85f7f8e95]
2017-10-04 11:59:09.902833+0530 AT&T EPTT[3684:1897067] COUCH LOG:Type-Router , Message- Runninf the router request on server thread
2017-10-04 11:59:09.903314+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-GET http://lite.couchbase./ptxdata/s919999990011_ptx1507098215332_a1507098215333_attachment.doc
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
2017-10-04 11:59:09.904558+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=563 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Accept-Ranges: bytes
Cache-Control: must-revalidate
Content-Type: application/json
Etag: "2-c29e2b0b7c42eaf6381d77dc04777f63"

2017-10-04 11:59:09.965843+0530 AT&T EPTT[3684:1897067] COUCH LOG:Type-Router , Message- Runninf the router request on server thread
2017-10-04 11:59:09.966255+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-GET http://lite.couchbase./_active_tasks
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
2017-10-04 11:59:09.967455+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=993 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Accept-Ranges: bytes
Cache-Control: must-revalidate
Content-Type: application/json
2017-10-04 11:59:09.984779+0530 AT&T EPTT[3684:1897067] COUCH LOG:Type-Router , Message- Runninf the router request on server thread
2017-10-04 11:59:09.985315+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-POST http://lite.couchbase./_replicate + 251-byte body
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
Origin: file://
2017-10-04 11:59:09.986353+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:@locqc11.hsqc.com/ptxdata] STARTING ...
2017-10-04 11:59:09.988610+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:
@locqc11.hsqc.com/ptxdata]: Reachability state = <locqc11.hsqc.com>:reachable (02), suspended=0
2017-10-04 11:59:09.989099+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:@locqc11.hsqc.com/ptxdata]: Going online
]2017-10-04 11:59:09.990938+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:
@locqc11.hsqc.com/ptxdata]: No local checkpoint; not getting remote one
2017-10-04 11:59:09.991411+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPuller[https://919999990011:*****@locqc11.hsqc.com/ptxdata] Progress: set active = 1
2017-10-04 11:59:10.004788+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-ChangeTracker , Message-CBLSocketChangeTracker[0x1c659db40 ptxdata]: Started... https://919999990011:*****@locqc11.hsqc.com/ptxdata/_changes?feed=normal&heartbeat=90000&style=all_docs&filter=sync_gateway/bychannel
2017-10-04 11:59:10.005322+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=24 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Content-Type: application/json

2017-10-04 11:59:10.016939+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-POST http://lite.couchbase./_replicate + 175-byte body
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
Origin: file://
2017-10-04 11:59:10.017325+0530 AT&T EPTT[3684:1897067] COUCH LOG:Type-Router , Message- Runninf the router request on server thread
2017-10-04 11:59:10.017843+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:@locqc11.hsqc.com/ptxdata] STOPPING...
2017-10-04 11:59:10.018403+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-GET http://lite.couchbase./ptxdata/s919999990011_ptx1507098233126_a1507098233127_attachment.doc
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
2017-10-04 11:59:10.019221+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=563 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Accept-Ranges: bytes
Cache-Control: must-revalidate
Content-Type: application/json
Etag: "2-60d86d89b9058a4f3460d42551b9065d"
2017-10-04 11:59:10.019887+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-GET http://lite.couchbase./ptxdata/s919999990011_ptx1507098319230_a1507098319231_attachment.doc
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60
Accept: application/json
Content-Type: application/json
2017-10-04 11:59:10.020631+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Router , Message-Response -- status=200, body=564 bytes
Server: CouchbaseLite 1.3.1 unofficial: commit
Accept-Ranges: bytes
Cache-Control: must-revalidate
Content-Type: application/json
Etag: "2-b569b98b7e6c2795e4363c6a2d4f3926"
2017-10-04 11:59:10.033096+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteJSONRequest[PUT https://919999990011:
@syncqc11.hsqc.com/ptxdata/_local/4d8aad54627dda98a3b609396c3947e85f7f8e95]: Got response, status 201
2017-10-04 11:59:10.038417+0530 AT&T EPTT[3684:1900817] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteSession done with CBLRemoteJSONRequest[PUT https://919999990011:@syncqc11.hsqc.com/ptxdata/_local/4d8aad54627dda98a3b609396c3947e85f7f8e95]
2017-10-04 11:59:10.039094+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteJSONRequest[PUT https://919999990011:
@syncqc11.hsqc.com/ptxdata/_local/4d8aad54627dda98a3b609396c3947e85f7f8e95]: Finished loading
2017-10-04 11:59:10.039692+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:@syncqc11.hsqc.com/ptxdata] Progress: set active = 0
2017-10-04 11:59:10.040150+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-Sync , Message-CBLRestPusher[https://919999990011:
@syncqc11.hsqc.com/ptxdata] STOPPED
2017-10-04 11:59:10.040405+0530 AT&T EPTT[3684:1897060] COUCH LOG:Type-(null) , Message-Replication: CBLRestPusher[https://919999990011:*****@syncqc11.hsqc.com/ptxdata] took 54.402 sec; error=(null)
2017-10-04 11:59:10.041790+0530 AT&T EPTT[3684:1900940] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteSession closed
2017-10-04 11:59:10.042194+0530 AT&T EPTT[3684:1900940] COUCH LOG:Type-RemoteRequest , Message-CBLRemoteSession closing
(lldb) bt


  • Version: CBL 1.4
  • Client OS: iOS 10.3
@msanilkumar2020
Copy link
Author

@snej / @pasin ,
Could you please check this crash?

@pasin pasin added this to the 1.4.1 milestone Oct 11, 2017
@pasin pasin self-assigned this Oct 11, 2017
@pasin
Copy link
Contributor

pasin commented Oct 11, 2017

I think it is a race between this line and this line. I will look into this today.

pasin added a commit that referenced this issue Oct 12, 2017
* The issue hapens due to the race between setting the _session to nil in the -URLSession:didBecomeInvalidWithError: delegate method and calling NSURLSession’s finishTasksAndInvalidate when closing the CBLRemoteSession. The issue is a regression of fixing #1429 (race of resetting _allRequests).

* Solution: created a strong session that will exists through the block execution.

* Note: Calling NSURLSessions’s -finishTasksAndInvalidate after the sesion is invalidated is no-ops operation (from manual testing).

#1923
@pasin
Copy link
Contributor

pasin commented Oct 12, 2017

@msanilkumar2020 I have committed the fix into the master branch. Could you please try it out? Thanks!

@pasin pasin closed this as completed Oct 12, 2017
@msanilkumar2020
Copy link
Author

Thanks @pasin .

@djpongh djpongh added bug and removed bug labels Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants