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

CBLWebSocket CLOSED #2269

Closed
srinadh-k opened this issue Dec 9, 2018 · 10 comments

Comments

@srinadh-k
Copy link

commented Dec 9, 2018


  • Version: CBLite V2.1.3
  • Client OS: iOS
  • Server: Couchbase Server 5.5

CBLWebScoket closed after some time, don't know reason exactly and it happing only in one app whereas i developed other apps it is working fine.

My observation, I restarted my replication 3 times,

  1. I started pull replication to get all data from the server.
  2. I called my IOT Device Rest APIs and stored locally and stopped previous replication and called push replication to synch my IOT device data to Server.
  3. Once push replication completed and then I stopped previous replication and called push-pull replication to sync mobile and server.

Seems it is very serious issue.
https://gist.github.com/srinadh-k/30442635a24805d46dd9ff41af6c8bcd

@pasin

This comment has been minimized.

Copy link
Contributor

commented Dec 9, 2018

Umm ... look like WebSocket got closed cleanly without stopping the replicator and that caused the continuous replicator to stopped.

@pasin pasin added bug P1: high labels Dec 9, 2018

@pasin pasin added this to the Iridium milestone Dec 9, 2018

@srinadh-k

This comment has been minimized.

Copy link
Author

commented Dec 9, 2018

Umm ... look like WebSocket got closed cleanly without stopping the replicator and that caused the continuous replicator to stopped.

I just wonder why it is only happening in only one app whereas i developed other app and it is working fine.
Do you know, is there any settings to configure on Xcode? Whereas I am calling my HTTP Rest API calls in my application, is it any cause? What are the possible causes it might occur? So i will debug it.

@pasin

This comment has been minimized.

Copy link
Contributor

commented Dec 9, 2018

I don't think you have done anything wrong especially calling the REST API shouldn't affect the replicator. I will need to check with the team about this scenario.

@srinadh-k

This comment has been minimized.

Copy link
Author

commented Dec 9, 2018

ok sure, i will look forward to hearing from you. Where we are planning to go for production and planning to take licensed version from couchbase soon.

@srinadh-k

This comment has been minimized.

Copy link
Author

commented Dec 11, 2018

@snej snej added the ffc label Dec 21, 2018

@djpongh djpongh added the ready label Jan 4, 2019

@jayahariv

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2019

Hi @srinadh-k,

Here is what we analyzed from the replication function you shared.

  1. config.allowReplicatingInBackground = true
    When setting the value to true, you will need to create a background task when the app goes into background and restart the replicator manually when the app is foreground. If you want CBL to automatically suspend the replicator when the app is in background and resume when the app is foreground, set the value to false. In most case, you would want to set this to false.

  2. self.replicator?.resetCheckpoint()
    The replicator will start syncing from the beginning again instead of continuing from the last checkpoint. Please make sure if this is what you want.

  3. Regarding this line (https://gist.github.com/srinadh-k/556194dafb53e1fd268bae68b76a7b88#file-replication-funtions-L60), If you want to stop the replicator when it’s idle, set config.continuous to false(single-shot replication).

@srinadh-k

This comment has been minimized.

Copy link
Author

commented Jan 10, 2019

@jayahariv I understood now, But when i set config.allowReplicatingInBackground = true and created a background task but iOS giving certain time interval for this and even we can not tell how much time it is allocated for our replication works but if I run background music, replication working as like in the foreground, But again here apple has some guidelines on this.

@jayahariv

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2019

@srinadh-k UIApplication.shared.backgroundTimeRemaining This will give the amount of time the app has to run in the background before it may be forcibly killed by the system.

@srinadh-k

This comment has been minimized.

Copy link
Author

commented Jan 10, 2019

I will check it UIApplication.shared.backgroundTimeRemaining and let you know. But i hope we can close this ticket Because you're right I am stopping replication forcefully.

@srinadh-k srinadh-k closed this Jan 10, 2019

@pasin pasin removed the ready label Jan 10, 2019

@jayahariv

This comment has been minimized.

Copy link
Contributor

commented Jan 10, 2019

thanks @srinadh-k

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.