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

Intialization failed with coroutine but works with rx on first time #160

Open
aashi-09 opened this issue Apr 30, 2024 · 2 comments
Open

Comments

@aashi-09
Copy link

I was trying to run the source code version 4.0.0 and in demo app it got initialised with rx java but throws error for coroutines. After a while only it works.

Expected : If it is working with rx in first go it should work with coroutine also.
Device : Samsung galaxy m31s, Android version 12.

Attaching a logs for reference.

SNTP request failed java.net.SocketTimeoutException: Poll timed out at libcore.io.IoBridge.poll(IoBridge.java:866) at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:151) at java.net.PlainDatagramSocketImpl.receive0(PlainDatagramSocketImpl.java:142) at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:164) at java.net.DatagramSocket.receive(DatagramSocket.java:849) at com.instacart.truetime.sntp.SntpImpl.requestTime(SntpImpl.java:136) at com.instacart.truetime.time.TrueTimeImpl.sntpRequest(TrueTimeImpl.kt:143) at com.instacart.truetime.time.TrueTimeImpl.requestTime(TrueTimeImpl.kt:129) at com.instacart.truetime.time.TrueTimeImpl.initialize(TrueTimeImpl.kt:77) at com.instacart.truetime.time.TrueTimeImpl.access$initialize(TrueTimeImpl.kt:15) at com.instacart.truetime.time.TrueTimeImpl$sync$1.invokeSuspend(TrueTimeImpl.kt:30) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) <img width="1201" alt="Screenshot 2024-04-30 at 1 02 53 PM" src="https://github.com/instacart/truetime-android/assets/133672089/2190e9db-c344-408b-80db-43024de21839"> ![Screenshot_20240430-130417_TrueTime (Sample) for Android](https://github.com/instacart/truetime-android/assets/133672089/5fdf5e61-cdd5-45ab-aa41-81f55e0ecf53)

@aashi-09
Copy link
Author

Screenshot 2024-04-30 at 1 02 53 PM ![Screenshot_20240430-130417_TrueTime (Sample) for Android](https://github.com/instacart/truetime-android/assets/133672089/c10d6e75-f459-442c-8c70-5b8265da96c9)

@ShowMe01
Copy link

ShowMe01 commented Jul 9, 2024

I have same problem, that's because kotlin's version use "time.apple.com" while rx use "time.google.com".

And apple's ntp server may slower than google, so socket connection timeout.

Change them into same ntp host.

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

2 participants