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

Android: Replication 'ChangeTracker' errors when replicate.continuous = true #77

Open
Galaloo opened this issue Aug 2, 2014 · 3 comments

Comments

@Galaloo
Copy link

Galaloo commented Aug 2, 2014

Running into some errors with replication.

    var manager = require('com.obscure.titouchdb').databaseManager, db = manager.getDatabase('testdb');

    var pullReplicate = db.createPullReplication('https://aaatest:[email protected]/aaatest');

    pullReplicate.continuous = true;

    pullReplicate.addEventListener('status', function(e) {
        Ti.API.info('syncing Changes ' + pullReplicate.completedChangesCount);
    });

    pullReplicate.start();

Gives me the following errors after a minute or two

[ERROR] :  ChangeTracker: com.couchbase.lite.replicator.ChangeTracker@52b45bac: Exception in change tracker
[ERROR] :  ChangeTracker: java.net.SocketTimeoutException: Read timed out
[ERROR] :  ChangeTracker:   at org.apache.harmony.xnet.provider.jsse.NativeCrypto.SSL_read(Native Method)
[ERROR] :  ChangeTracker:   at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl$SSLInputStream.read(OpenSSLSocketImpl.java:673)
[ERROR] :  ChangeTracker:   at org.apache.http.impl.io.AbstractSessionInputBuffer.fillBuffer(AbstractSessionInputBuffer.java:103)
[ERROR] :  ChangeTracker:   at org.apache.http.impl.io.AbstractSessionInputBuffer.readLine(AbstractSessionInputBuffer.java:191)
[ERROR] :  ChangeTracker:   at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStream.java:220)
[ERROR] :  ChangeTracker:   at org.apache.http.impl.io.ChunkedInputStream.nextChunk(ChunkedInputStream.java:183)
[ERROR] :  ChangeTracker:   at org.apache.http.impl.io.ChunkedInputStream.read(ChunkedInputStream.java:155)
[ERROR] :  ChangeTracker:   at org.apache.http.conn.EofSensorInputStream.read(EofSensorInputStream.java:159)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.impl.Utf8StreamParser.loadMore(Utf8StreamParser.java:172)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.impl.Utf8StreamParser._skipWSOrEnd(Utf8StreamParser.java:2304)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.impl.Utf8StreamParser.nextToken(Utf8StreamParser.java:438)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer.mapArray(UntypedObjectDeserializer.java:157)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.deser.std.UntypedObjectDeserializer.deserialize(UntypedObjectDeserializer.java:51)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.deser.std.MapDeserializer._readAndBind(MapDeserializer.java:319)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:249)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.deser.std.MapDeserializer.deserialize(MapDeserializer.java:33)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2723)
[ERROR] :  ChangeTracker:   at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1900)
[ERROR] :  ChangeTracker:   at com.couchbase.lite.replicator.ChangeTracker.run(ChangeTracker.java:319)
[ERROR] :  ChangeTracker:   at java.lang.Thread.run(Thread.java:841)

The error messages will appear every few minutes.

Removing authentication with

    var pullReplicate = db.createPullReplication('https://prepandpantry.iriscouch.com/aaatest1');

Still throws the 'ChangeTracker' error. In both instances replication of changes still work.

Setting continuous to FALSE then no more error.

    pullReplicate.continuous = true;
@FrancoisMeriaux
Copy link

This is an issue we are also facing on Android with a continuous replication over HTTPS. From what we understand, the connection is closed after it has been idle for some time. However, on Android, the replication starts again after this error, then the error appears, then it starts again...

On iOS, we face a similar issue but the connection is killed silently, i.e. we do not get any error message and the replication does not recover from the error since it is not even detected.

The workaround we use so far is to automatically restart the replication after it has been idle for 50 seconds so we avoid the connexion being closed unintentionally.

For a proper fix, it seems that working on the heartbeat parameter can be an interesting lead, as discussed here https://groups.google.com/forum/#!topic/mobile-couchbase/edjN7wRNLM0

@pegli
Copy link
Collaborator

pegli commented Aug 8, 2014

This appears to be an open issue with couchbase-lite-android: couchbase/couchbase-lite-android#330

I've subscribed to that issue and will update the module when the underlying library is fixed. A temporary workaround might be to use one-shot replication (continuous=false) and trigger it periodically via a timer.

@riksof-raheel
Copy link

hello i also faced that problem is that issue fixed now ?

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