Leaving a phone in airplane mode for a couple of minutes, then try to activate it again. The Java layer does not seem to handle this well resulting in the access token not being refreshed
10-10 13:58:15.082 20935-21485/io.realm.examples.objectserver E/REALM_SYNC: Connection[2]: Failed to connect to endpoint '192.168.87.111:9080': Network is unreachable
10-10 13:58:15.083 20935-21485/io.realm.examples.objectserver E/REALM_SYNC: Connection[2]: Failed to connect to '192.168.87.111:9080': All endpoints failed
10-10 13:58:15.083 20935-21485/io.realm.examples.objectserver D/REALM_SYNC: Connection[2]: Reconnecting in 55173 milliseconds
10-10 13:58:20.776 20935-20935/io.realm.examples.objectserver D/REALM_JAVA: NetworkListener: Connection available
10-10 13:58:47.485 20935-22048/io.realm.examples.objectserver D/REALM_JAVA: Network request (authenticate): http://192.168.87.111:9080/auth
10-10 13:58:54.420 20935-20935/io.realm.examples.objectserver D/REALM_JAVA: NetworkListener: Connection available
10-10 13:58:54.422 20935-20935/io.realm.examples.objectserver D/REALM_JAVA: NetworkListener: Connection available
10-10 13:58:59.640 20935-22048/io.realm.examples.objectserver D/REALM_JAVA: AuthenticateResponse - Error: UNKNOWN(-1)
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:139)
at okio.Okio$2.read(Okio.java:138)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:344)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:216)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at okhttp3.RealCall.execute(RealCall.java:69)
at io.realm.internal.network.OkHttpAuthenticationServer.authenticate(OkHttpAuthenticationServer.java:145)
at io.realm.internal.network.OkHttpAuthenticationServer.refreshUser(OkHttpAuthenticationServer.java:80)
at io.realm.SyncSession$4.execute(SyncSession.java:644)
at io.realm.SyncSession$4.execute(SyncSession.java:640)
at io.realm.internal.network.ExponentialBackoffTask.run(ExponentialBackoffTask.java:66)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
10-10 13:58:59.643 20935-22048/io.realm.examples.objectserver E/REALM_JAVA: Unrecoverable error, while refreshing the access Token (UNKNOWN(-1)
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:209)
at java.net.SocketInputStream.read(SocketInputStream.java:139)
at okio.Okio$2.read(Okio.java:138)
at okio.AsyncTimeout$2.read(AsyncTimeout.java:236)
at okio.RealBufferedSource.indexOf(RealBufferedSource.java:344)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:216)
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:210)
at okhttp3.internal.http1.Http1Codec.readResponseHeaders(Http1Codec.java:189)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:75)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:120)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:92)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:67)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:185)
at okhttp3.RealCall.execute(RealCall.java:69)
at io.realm.internal.network.OkHttpAuthenticationServer.authenticate(OkHttpAuthenticationServer.java:145)
at io.realm.internal.network.OkHttpAuthenticationServer.refreshUser(OkHttpAuthenticationServer.java:80)
at io.realm.SyncSession$4.execute(SyncSession.java:644)
at io.realm.SyncSession$4.execute(SyncSession.java:640)
at io.realm.internal.network.ExponentialBackoffTask.run(ExponentialBackoffTask.java:66)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
) reschedule will not happen
10-10 13:59:10.055 20935-21485/io.realm.examples.objectserver I/REALM_SYNC: Connection[2]: Resolving '192.168.87.111:9080'
10-10 13:59:10.061 20935-21485/io.realm.examples.objectserver I/REALM_SYNC: Connection[2]: Connecting to endpoint '192.168.87.111:9080' (1/1)
10-10 13:59:10.503 20935-21485/io.realm.examples.objectserver I/REALM_SYNC: Connection[2]: Connected to endpoint '192.168.87.111:9080' (from '192.168.87.104:44952')
10-10 13:59:10.503 20935-21485/io.realm.examples.objectserver D/REALM_SYNC: Connection[2]: WebSocket::initiate_client_handshake()
10-10 13:59:10.577 20935-21485/io.realm.examples.objectserver E/REALM_SYNC: Connection[2]: Websocket: HTTP response invalid
10-10 13:59:10.577 20935-21485/io.realm.examples.objectserver I/REALM_SYNC: Connection[2]: Connection closed due to error
10-10 13:59:10.577 20935-21485/io.realm.examples.objectserver D/REALM_SYNC: Connection[2]: Reconnecting in 3182343 milliseconds
It might be enough to add this exception to https://github.com/realm/realm-java/pull/5431/files#diff-1e7df1f858beb02c9e752427c0be8f68R203
I'm not sure what the implications are if we allow retries for all IOExceptions. Are we potentially able to recover from all of them?
Hello @nhachicha, it looks like i got the same issue here https://stackoverflow.com/questions/48217332/realm-sync-not-working-after-reconnecting-to-the-internet could you please check?
Hello all. i've downgrade android build to 4.0.0 and sync starts working. could you please check what is wrong with 4.3.1?
thank you
Hi @SiarheiSm does it work until 4.1.0? since Sync dependency didn't change between 4.0.0 and 4.1.0 I'm trying to isolate the exact version for this issue
Hello @nhachicha. yes, it is works for 4.1.0.
Now question is of course whether it worked in 4.1.1 and in 4.2.0.
There was also 4.3.0? There seems to have been Sync version upgrades in pretty much all of them. :|
Hello @Zhuinden! 4.3.0 not working ,
update: 4.2.0 - works ok
Upgraded to Realm Sync 2.1.8.
Previously was Realm Sync 2.1.4
@nhachicha I guess that's where something broke, there was no relevant change in Realm Java
Hi @SiarheiSm can you try the 4.3.2-SNAPSHOT this includes the latest Realm Sync + minor fix for the ErrorCode error log you've been seeing
Hello @nhachicha .
thank you for providing snapshot. it looks like it works, i need to do more tests.
only item i found it is when user switches to offline mode errorHandler calls each time on reconnection fails, so as for me application not sure is it possible to use config or not. 4.2.0 works a different way, as i understand it provides config to use in offline mode and there is no 'fails'. could you please check it? thank you
Hi @SiarheiSm before this SNAPSHOT, in your case, the error handler registered with your configuration was not invoked, simply because we failed to parse the error code provided from the system error, now that we parse all error codes, this callback should be notified accordingly.
The SyncConfiguration is orthogonal to the connection state (whether it's offline/online). The idea is that you shouldn't worry about the state of connection since the sync will resume automatically when the network is back.
You might be referring to this SyncConfiguration#forRecovery which returns a SyncConfiguration used to inspect a Realm (in case of recovery, for instance)
it seems to work now. thank you 馃憤
Most helpful comment
it seems to work now. thank you 馃憤