instacart / truetime-android

Android NTP time library. Get the true current time impervious to device clock time changes
https://tech.instacart.com/truetime/
Apache License 2.0
1.41k stars 194 forks source link

Library throw exception in rx flow #111

Open Vaek opened 5 years ago

Vaek commented 5 years ago

Actually we log exceptions from library. What fix you suggest?

java.io.IOException: Operation not permitted
    at java.net.PlainDatagramSocketImpl.send(PlainDatagramSocketImpl.java)
    at java.net.DatagramSocket.send(DatagramSocket.java:696)
    at com.instacart.library.truetime.SntpClient.requestTime(SntpClient.java:116)
    at com.instacart.library.truetime.TrueTime.requestTime(TrueTime.java:133)
    at com.instacart.library.truetime.TrueTimeRx$4$1$2.subscribe(TrueTimeRx.java:211)
    at io.reactivex.internal.operators.flowable.FlowableCreate.subscribeActual(FlowableCreate.java:72)
    at io.reactivex.Flowable.subscribe(Flowable.java:14409)
    at io.reactivex.Flowable.subscribe(Flowable.java:14356)
    at io.reactivex.internal.operators.flowable.FlowableSubscribeOn$SubscribeOnSubscriber.run(FlowableSubscribeOn.java:82)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:66)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:57)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)
jemshit commented 5 years ago

Use https://github.com/instacart/truetime-android/issues/101#issuecomment-461219933

Vaek commented 5 years ago

Thanks but it is not solution. We already have set global rx error handler. Error should be catched by subscribed observer, if it would be thrown in init flow, but these errors are thrown in library scheduled work. What about add subscription for these scheduled work? In global error handler we are not able to recognise this IOException from other errors.

LosDanieloss commented 5 years ago

I know it's been a while but I've posted my finding in here: https://github.com/instacart/truetime-android/issues/119#issuecomment-510043102 . Maybe this will help you somehow

DidUNooono commented 1 year ago

SDK Sdk