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

Replication.CompletedChangesCount is always 0 #438

Closed
ryanthompson0123 opened this issue Jun 23, 2015 · 9 comments
Closed

Replication.CompletedChangesCount is always 0 #438

ryanthompson0123 opened this issue Jun 23, 2015 · 9 comments
Assignees
Labels
Milestone

Comments

@ryanthompson0123
Copy link

Using version 1.1.0.1 in my Xamarin apps, the completed changes count always shows 0 during replication. The following error is printed to the console lots of times during replication and I think it's related:

2015-06-23 15:01:24.422 MyApp[28579:2437672] Database: Exception getting status from System.Collections.Generic.Dictionary`2[System.String,System.Object]
2015-06-23 15:01:24.422 MyApp[28579:2437672]     
2015-06-23 15:01:24.422 MyApp[28579:2437672] System.InvalidCastException: Unable to cast object of type 'System.Int64' to type 'System.String'.
2015-06-23 15:01:24.422 MyApp[28579:2437672] 
2015-06-23 15:01:24.422 MyApp[28579:2437672]     
2015-06-23 15:01:24.422 MyApp[28579:2437672]   at Couchbase.Lite.Replicator.Puller.StatusFromBulkDocsResponseItem (IDictionary`2 item) [0x0004c] in /Users/zgramana/Source/couchbase-lite-net/src/Couchbase.Lite.Shared/Replication/Puller.cs:701 
2015-06-23 15:01:24.422 MyApp[28579:2437672] 
2015-06-23 15:01:24.423 MyApp[28579:2437672] Replication:  Progress: set error = 
2015-06-23 15:01:24.423 MyApp[28579:2437672]     
2015-06-23 15:01:24.423 MyApp[28579:2437672] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: Ok
2015-06-23 15:01:24.423 MyApp[28579:2437672] 

@borrrden
Copy link
Member

Could you post a bit more of your logs? Are you using Sync Gateway? If so, what version?

@ryanthompson0123
Copy link
Author

This is the only relevant information from the logs. We're using sync gateway version 1.0.3. I'm not sure if this combination is supported or not, but it seems to work fine except for this error.

I'm showing a progress bar to the user that's populated like this:

void Pull_Changed(object sender, ReplicationChangeEventArgs e)
{
    var replication = e.Source;
    if (replication.ChangesCount > 0)
    {
        // Progress is a property that fires an event when it changes
        Progress = (float)replication.CompletedChangesCount / (float)replication.ChangesCount * 100;
    }
    else
    {
        Progress = 0;
    }
}

This used to work great, but now CompletedChangesCount is always 0, even when ChangesCount is non-zero and documents are being replicated down.

@borrrden
Copy link
Member

In general we recommend users to keep up with the latest versions, if possible. I'll see if I can reproduce this with 1.1.

@borrrden
Copy link
Member

@ryanthompson0123 I've noticed that sometimes things can be called in a confusing order. I tried running my unit test which runs on the completed changes count, and the count did change, but not until after the status was changed to idle (or stopped). Could this possibly be causing the trouble you are having?

@zgramana zgramana added the bug label Jun 26, 2015
@zgramana zgramana modified the milestones: 1.2, 1.1.1 Jun 26, 2015
@borrrden
Copy link
Member

borrrden commented Jul 9, 2015

@ryanthompson0123 I've made a substantial refactor to the replication code base, and pushed it to a branch called issue/438. Could you take a look at it and see if it fixes your problem?

@ryanthompson0123
Copy link
Author

@borrrden Thanks! I will take a look at it on Monday 7/13. I did take your advice though and wait until the after the status change to get the count, and that started giving me results, but I still see that error message showing up in the logs.

@ryanthompson0123
Copy link
Author

First off, when I built the iOS solution I had to manually add the Stateless NuGet package to get it to compile. I'm not sure if that's by design, or just needs to be added to the solution in git, but I wanted to let you know.

As far as using it, the actual changes counts seem much more reliable now, and they come in when I would expect them to. However, there's still an error being spit out to the console, but it's slightly different than before. Here's my logs (lines starting with "PULL" and "REPLICATOR" are my own logging statements that trigger when Replication.Changed is fired, everything else is coming from Couchbase Lite):

2015-07-13 10:39:42.756 MyApp[12441:617361] : PULL:  0 / 272 changes
2015-07-13 10:39:42.757 MyApp[12441:617361] PULL:  0 / 274 changes
2015-07-13 10:39:42.757 MyApp[12441:617361] : PULL:  0 / 274 changes
2015-07-13 10:39:42.758 MyApp[12441:617361] PULL:  0 / 275 changes
Thread finished:  #30
2015-07-13 10:39:42.758 MyApp[12441:617361] : PULL:  0 / 275 changes
Thread finished: Change Tracker Thread #28
2015-07-13 10:39:42.759 MyApp[12441:617361] PULL:  0 / 275 changes
2015-07-13 10:39:42.760 MyApp[12441:617361] : PULL:  0 / 275 changes
2015-07-13 10:39:43.163 MyApp[12441:617361] PULL:  269 / 275 changes
2015-07-13 10:39:43.164 MyApp[12441:617361] : PULL:  269 / 275 changes
Thread started:  #24
2015-07-13 10:39:43.281 MyApp[12441:647476] Replication:  Progress: set error = 
2015-07-13 10:39:43.281 MyApp[12441:647476]     
2015-07-13 10:39:43.281 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.282 MyApp[12441:647476] 
2015-07-13 10:39:43.283 MyApp[12441:617361] PULL:  270 / 275 changes
2015-07-13 10:39:43.284 MyApp[12441:617361] : PULL:  270 / 275 changes
2015-07-13 10:39:43.287 MyApp[12441:617361] PULL:  270 / 275 changes
2015-07-13 10:39:43.288 MyApp[12441:647476] Replication:  Progress: set error = 
2015-07-13 10:39:43.288 MyApp[12441:647476]     
2015-07-13 10:39:43.288 MyApp[12441:617361] : PULL:  270 / 275 changes
2015-07-13 10:39:43.288 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.288 MyApp[12441:647476] 
2015-07-13 10:39:43.289 MyApp[12441:617361] PULL:  271 / 275 changes
2015-07-13 10:39:43.289 MyApp[12441:617361] : PULL:  271 / 275 changes
2015-07-13 10:39:43.290 MyApp[12441:617361] PULL:  271 / 275 changes
2015-07-13 10:39:43.290 MyApp[12441:647476] Replication:  Progress: set error = 
2015-07-13 10:39:43.290 MyApp[12441:647476]     
2015-07-13 10:39:43.290 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.290 MyApp[12441:647476] 
2015-07-13 10:39:43.290 MyApp[12441:617361] : PULL:  271 / 275 changes
2015-07-13 10:39:43.291 MyApp[12441:617361] PULL:  272 / 275 changes
2015-07-13 10:39:43.291 MyApp[12441:617361] : PULL:  272 / 275 changes
2015-07-13 10:39:43.292 MyApp[12441:617361] PULL:  272 / 275 changes
2015-07-13 10:39:43.292 MyApp[12441:617361] Replication:  Progress: set error = : PULL:  272 / 275 changes
2015-07-13 10:39:43.292 MyApp[12441:647476] 
2015-07-13 10:39:43.292 MyApp[12441:647476]     
2015-07-13 10:39:43.292 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.292 MyApp[12441:647476] 
2015-07-13 10:39:43.293 MyApp[12441:617361] PULL:  273 / 275 changes
2015-07-13 10:39:43.293 MyApp[12441:617361] : PULL:  273 / 275 changes
2015-07-13 10:39:43.293 MyApp[12441:617361] PULL:  273 / 275 changes
2015-07-13 10:39:43.294 MyApp[12441:647476] Replication:  Progress: set error = 
2015-07-13 10:39:43.294 MyApp[12441:647476]     
2015-07-13 10:39:43.294 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.294 MyApp[12441:647476] 
2015-07-13 10:39:43.294 MyApp[12441:617361] : PULL:  273 / 275 changes
2015-07-13 10:39:43.294 MyApp[12441:617361] PULL:  274 / 275 changes
2015-07-13 10:39:43.295 MyApp[12441:617361] : PULL:  274 / 275 changes
2015-07-13 10:39:43.295 MyApp[12441:617361] PULL:  274 / 275 changes
2015-07-13 10:39:43.295 MyApp[12441:647476] Replication:  Progress: set error = 
2015-07-13 10:39:43.295 MyApp[12441:647476]     
2015-07-13 10:39:43.295 MyApp[12441:647476] Couchbase.Lite.CouchbaseLiteException: Coucbase Lite error: UpStreamError
2015-07-13 10:39:43.295 MyApp[12441:647476] 
2015-07-13 10:39:43.296 MyApp[12441:617361] : PULL:  274 / 275 changes
2015-07-13 10:39:43.296 MyApp[12441:617361] PULL:  275 / 275 changes
2015-07-13 10:39:43.296 MyApp[12441:617361] : PULL:  275 / 275 changes
Thread finished:  #24
2015-07-13 10:39:43.297 MyApp[12441:617361] PULL:  275 / 275 changes
2015-07-13 10:39:43.297 MyApp[12441:617361] : PULL:  275 / 275 changes
2015-07-13 10:39:43.298 MyApp[12441:617361] PULL:  275 / 275 changes
2015-07-13 10:39:43.298 MyApp[12441:617361] : PULL:  275 / 275 changes
2015-07-13 10:39:56.424 MyApp[12441:624375] REPLICATOR:   COMPLETE!

At this point, this doesn't seem to be causing me any issues, the log messages are the only symptom.

@borrrden
Copy link
Member

Doh, no of course that was not intentional. That's a symptom of my tunnel vision. I'm worried about that log message though. Are the documents that throw those messages getting synced properly? That message looks like you have docs stored in the remote DB without an _id property.

@borrrden borrrden mentioned this issue Jul 18, 2015
@borrrden borrrden self-assigned this Jul 18, 2015
borrrden added a commit that referenced this issue Jul 18, 2015
@borrrden
Copy link
Member

I'm going to close this ticket since the log messages are probably not related to this issue in particular.

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