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

Document deletion not sync'd because user loses access to channel during deletion #1484

Closed
tleyden opened this issue Jan 19, 2016 · 17 comments
Closed
Milestone

Comments

@tleyden
Copy link
Contributor

tleyden commented Jan 19, 2016

Steps to reproduce:

Sg logs: https://gist.github.com/tleyden/339d9a0b5d5f8306d494

bulk get request capture from http scoop: https://gist.github.com/tleyden/b536a5dace244b4d8c7e

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

Action items:

  • Smoke test same test against channel cache version
  • See if there are multiple pull replicators running, or why changes requests look strange
  • Smoke test deletes @adamcfraser

@tleyden tleyden added this to the 1.2.0 milestone Jan 19, 2016
@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

Test channel cache version steps:

  • Delete todolite from device + simulator
  • Change constant to #define kSyncGatewayUrl @"http://ec2-54-145-244-2.compute-1.amazonaws.com:4984/todolite-cc/"
  • Deploy to simulator and device
  • Verify that todo lists / items match up
  • Add new list to device, 1484_list_1
  • Verified it sync'd to simulator (lag time: negligible)
  • Delete on simulator

Expected: Delete sync'd to device and 1484_list_1 should disappear from list
Actual: 1484_list_1 stayed in list

  • Add new list on simulator, 1484_list_2
  • Verified it sync'd to device (lag time: negligible) Note: 1484_list_1 still did not delete from device

So it's either a bug in todolite-ios or the Sync Gateway bug is present in both channel cache and distributed index mode.

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

Test channel cache version steps:

  • Delete todolite from device + simulator
  • Change constant to #define kSyncGatewayUrl @"http://ec2-54-145-244-2.compute-1.amazonaws.com:4984/todolite-cc/"
  • Deploy to simulator and device
  • Verify that todo lists / items match up
  • Add new list to device, 1484_list_3
  • Verified it sync'd to simulator (lag time: negligible)
  • Delete 1484_list_3 on device

Actual: 1484_list_3 never deleted from simulator (waited approx 1 min)
Expected: 1484_list_3 should have deleted from simulator

Logs:

https://gist.github.com/tleyden/9d61bf3dba43d9fba50d

@adamcfraser
Copy link
Collaborator

Sanity tested deletes locally - worked as expected. Test details here:
https://gist.github.com/adamcfraser/59f83807617266aa4b36

@hideki
Copy link

hideki commented Jan 19, 2016

Run ToDo Lite Android against sync gateway 1.2 and DI version of SG 1.2.
ToDo Lite Android works fine with both of them
couchbaselabs/ToDoLite-Android#64 (comment)

NOTE: ToDo Lite Android does not support the deleting the task list.

@pasin
Copy link

pasin commented Jan 19, 2016

I can reproduce what @tleyden commented. I noticed from the log that the device did push the deleted change to the sync-gateway but on the simulator, from the log, it seemed like there is no changes coming.

@pasin
Copy link

pasin commented Jan 19, 2016

What do I need to do to setup the Sync-Gateway with the same configuration on my local machine?

@pasin
Copy link

pasin commented Jan 19, 2016

Note that: deleting a task can be propagated but deleting a list cannot. Is this could be sync-function issue?

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

@pasin For a local setup run Sync Gateway commit 760444c with config: https://github.com/couchbaselabs/sync-gateway-testcluster/pull/230/files -- I can help you in more detail later

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

@pasin the delete seems to propagate if you delete app and do a fresh pull (though I need to retest), which means it's not a sync function issue, and that client is correctly pushing the delete

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

Testing against Sync Gateway 1.1.1 (http://ec2-54-161-209-25.compute-1.amazonaws.com:4984/todolite-cc/)

  • On device, add 1484_list_4
  • Verify it sync's to emulator
  • On device, delete 1484_list_4

Actual: 1484_list_4 never deleted from simulator (waited approx 1 min)
Expected: 1484_list_4 should have deleted from simulator

Logs: https://gist.github.com/tleyden/71ee8520805315ed78ed

If I delete the app from the simulator and re-install, it shows 1484_list_4 as being deleted.

Todolite ios logs after app reinstall: https://gist.github.com/tleyden/fd338a2068d8728c2c86

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

It definitely looks like an issue in todolite-ios at this point, so closing this and leaving couchbaselabs/ToDoLite-iOS#54 open.

@tleyden tleyden closed this as completed Jan 19, 2016
@pasin
Copy link

pasin commented Jan 19, 2016

I tested with Sync-Gateway 1.1.1 with https://github.com/couchbaselabs/ToDoLite-iOS/blob/master/sync-gateway-config.json, and there is NO issue about deleting the list.

@pasin pasin reopened this Jan 19, 2016
@pasin
Copy link

pasin commented Jan 19, 2016

I just reopened the issue as the issue might not be at ToDoLite-iOS.

@tleyden
Copy link
Contributor Author

tleyden commented Jan 19, 2016

Possibly related to #264

@tleyden tleyden modified the milestones: 1.3, 1.2.0 Jan 20, 2016
@tleyden
Copy link
Contributor Author

tleyden commented Jan 21, 2016

It appears the change is not being propagated because of the way the sync function is written with relation to access grants, not due to a bug in the changes processing. For example, if you listen on the port 4985 changes feed, the change will reliably make it to the changes feed.

The reason the behavior is sporadic (in both 1.1.1 and 1.2.0-rc0) is due to a known race condition in the way the sync function is written, because the following things are happening concurrently inside of SG when a list document such as list-1 is deleted:

  1. The user loses access to the list-1 channel, since the document granting access to it is gone
  2. The notification function sends new changes about the list-1 channel, including the delete

If the notification happens first, the deletion will appear in the user's changes feed, otherwise it will never appear.

Workaround: if the list document is deleted, explicitly grant access to the channel. Downside: this will bloat couchbase server documents with dead channels.

@tleyden tleyden changed the title Todolite ios deletes not propagating / slow to propagate Document deletion not sync'd because user loses access to channel during deletion Jan 21, 2016
pasin added a commit to couchbaselabs/ToDoLite-iOS that referenced this issue Jul 14, 2016
- Ensure to grant the user to the list channel when the list is deleted.
- Update database name from todos to todolite
- Set log to *

#54 and couchbase/sync_gateway#1484 (comment)
@tleyden
Copy link
Contributor Author

tleyden commented Jul 26, 2016

Closing as duplicate of #2005

@tleyden tleyden closed this as completed Jul 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants