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

Causes ANR and SocketTimeoutException on emulators #68

Closed
EdwardvanRaak opened this Issue Sep 19, 2017 · 19 comments

Comments

Projects
None yet
@EdwardvanRaak

EdwardvanRaak commented Sep 19, 2017

Simply running the RxTrueTime sample2 on an Android emulator causes java.net.SocketTimeoutException Poll timed out. It's even causing ANR's inside my own project (also on emulators).

Tried this on 2 separate environments running emulators with different Android versions, they all show the same problem.

Everything works fine on my real devices.

Is this expected behavior and can I ignore this or should this actually work?

Logs:


09-19 16:44:26.899 20496-21765/com.instacart.library.truetime D/TrueTimeRx: ---- resolving ntpHost : time.google.com
09-19 16:44:26.901 20496-21768/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 216.239.35.8
09-19 16:44:26.901 20496-21769/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 216.239.35.8
09-19 16:44:26.901 20496-21770/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 216.239.35.8
09-19 16:44:26.902 20496-21771/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 216.239.35.8
09-19 16:44:26.902 20496-21772/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 216.239.35.8
09-19 16:44:26.902 20496-21773/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 2001:4860:4806:8::
09-19 16:44:26.903 20496-21774/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 2001:4860:4806:8::
09-19 16:44:26.903 20496-21775/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 2001:4860:4806:8::
09-19 16:44:26.903 20496-21776/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 2001:4860:4806:8::
09-19 16:44:26.903 20496-21777/com.instacart.library.truetime D/TrueTimeRx: ---- requestTime from: 2001:4860:4806:8::

Logs don't continue after that, it just loops forever and showing the SocketTimeoutException + causing the ANR.

@EdwardvanRaak

This comment has been minimized.

Show comment
Hide comment
@EdwardvanRaak

EdwardvanRaak Sep 19, 2017

So I researched this a bit and if I understand correctly SNTP clients are simply not supported on emulators? Can anyone confirm this?

I tried out other SNTP client apps on my emulators and they also failed.¯_(ツ)_/¯

EdwardvanRaak commented Sep 19, 2017

So I researched this a bit and if I understand correctly SNTP clients are simply not supported on emulators? Can anyone confirm this?

I tried out other SNTP client apps on my emulators and they also failed.¯_(ツ)_/¯

@Seidak

This comment has been minimized.

Show comment
Hide comment
@Seidak

Seidak Sep 20, 2017

It looks like I have the same problem for real device. Its Sony E5823. Any ideas what should we do? :)

Seidak commented Sep 20, 2017

It looks like I have the same problem for real device. Its Sony E5823. Any ideas what should we do? :)

@kaushikgopal

This comment has been minimized.

Show comment
Hide comment
@kaushikgopal

kaushikgopal Oct 5, 2017

Collaborator

🤔 interestingly i'm noticing this behavior too now, on my emulator. This was not the case before. I used to be able to use SNTP before. Let me try snooping around and checking if there's something we can do.

sadly, if nothing comes out of this investigation, real devices have to be used i suppose 😞

Collaborator

kaushikgopal commented Oct 5, 2017

🤔 interestingly i'm noticing this behavior too now, on my emulator. This was not the case before. I used to be able to use SNTP before. Let me try snooping around and checking if there's something we can do.

sadly, if nothing comes out of this investigation, real devices have to be used i suppose 😞

@Seidak

This comment has been minimized.

Show comment
Hide comment
@Seidak

Seidak Oct 5, 2017

@kaushikgopal but I've experienced the same problem on the real device as I mentioned above. :(

Seidak commented Oct 5, 2017

@kaushikgopal but I've experienced the same problem on the real device as I mentioned above. :(

@kaushikgopal

This comment has been minimized.

Show comment
Hide comment
@kaushikgopal

kaushikgopal Oct 5, 2017

Collaborator

@Seidak hmm.. can you provide more info. What ntp pool address are you hitting. can you post your exact stack trace. without more info, not sure how to help as i'm not seeing the same problem

Collaborator

kaushikgopal commented Oct 5, 2017

@Seidak hmm.. can you provide more info. What ntp pool address are you hitting. can you post your exact stack trace. without more info, not sure how to help as i'm not seeing the same problem

@jksiezni

This comment has been minimized.

Show comment
Hide comment
@jksiezni

jksiezni Oct 17, 2017

Hi, maybe it's not related to this issue particularly, but there is a bug in TrueTime that causes ANRs on every device.
The problem is with synchronized methods in SntpCient (886acc1). Every time you try to call TrueTime.isInitialized() or TrueTime.now() on the main thread, it's blocked by requestTime(). It's a serious issue when the NTP server lags or don't even respond.

jksiezni commented Oct 17, 2017

Hi, maybe it's not related to this issue particularly, but there is a bug in TrueTime that causes ANRs on every device.
The problem is with synchronized methods in SntpCient (886acc1). Every time you try to call TrueTime.isInitialized() or TrueTime.now() on the main thread, it's blocked by requestTime(). It's a serious issue when the NTP server lags or don't even respond.

@lemberh

This comment has been minimized.

Show comment
Hide comment
@lemberh

lemberh Nov 2, 2017

@jksiezni Look like you are right.
Quick fix would be to downgrade library version to 2.2, there it works for me

lemberh commented Nov 2, 2017

@jksiezni Look like you are right.
Quick fix would be to downgrade library version to 2.2, there it works for me

@kaushikgopal

This comment has been minimized.

Show comment
Hide comment
@kaushikgopal

kaushikgopal Nov 2, 2017

Collaborator

@jksiezni @lemberh - i have an branch "sync_to_atomic" that should address that issue. I'm giving it a run in production internally before merging it to make sure it has an effect. it's looking promising so far.

feel free to give that a shot (you can point directly to the commit via jitpack).

i'll have that branch merged as soon as i gain some real world data. 🤞

Collaborator

kaushikgopal commented Nov 2, 2017

@jksiezni @lemberh - i have an branch "sync_to_atomic" that should address that issue. I'm giving it a run in production internally before merging it to make sure it has an effect. it's looking promising so far.

feel free to give that a shot (you can point directly to the commit via jitpack).

i'll have that branch merged as soon as i gain some real world data. 🤞

@lemberh

This comment has been minimized.

Show comment
Hide comment
@lemberh

lemberh Nov 2, 2017

@kaushikgopal I tried and so far it works great, @Seidak try version from the branch, maybe it will work for you,
And looks like this issue is also related #69

lemberh commented Nov 2, 2017

@kaushikgopal I tried and so far it works great, @Seidak try version from the branch, maybe it will work for you,
And looks like this issue is also related #69

@fecogc

This comment has been minimized.

Show comment
Hide comment
@fecogc

fecogc Nov 21, 2017

Hi @kaushikgopal I wasn't able to get the branch from jitpack.. Is this the correct brach name?

https://jitpack.io/#instacart/truetime-android/kg~fix/sync_to_atomic-SNAPSHOT

compile 'com.github.instacart.truetime-android:library-extension-rx:kg~fix'

fecogc commented Nov 21, 2017

Hi @kaushikgopal I wasn't able to get the branch from jitpack.. Is this the correct brach name?

https://jitpack.io/#instacart/truetime-android/kg~fix/sync_to_atomic-SNAPSHOT

compile 'com.github.instacart.truetime-android:library-extension-rx:kg~fix'

@sreejithbnaick

This comment has been minimized.

Show comment
Hide comment
@sreejithbnaick

sreejithbnaick Jan 12, 2018

IPv6 Addresses are timing out both on Emulator(Google) and Real Device(Xiaomi Note4), causing a long loop of retry. Filtering IPv4 address worked better for me.

(FYI: I was running AndroidTest, not in a real application)
Host was default : 1.us.pool.ntp.org using code TrueTime.build().initialize()

sreejithbnaick commented Jan 12, 2018

IPv6 Addresses are timing out both on Emulator(Google) and Real Device(Xiaomi Note4), causing a long loop of retry. Filtering IPv4 address worked better for me.

(FYI: I was running AndroidTest, not in a real application)
Host was default : 1.us.pool.ntp.org using code TrueTime.build().initialize()

@Mugurell

This comment has been minimized.

Show comment
Hide comment
@Mugurell

Mugurell Jan 24, 2018

@fecogc
As per jitpack documentation - https://github.com/jitpack/jitpack.io/blob/master/FAQ.md
We can use 'com.github.instacart.truetime-android:library-extension-rx:kg~fix~sync_to_atomic-SNAPSHOT' to get that branch compiled.

Mugurell commented Jan 24, 2018

@fecogc
As per jitpack documentation - https://github.com/jitpack/jitpack.io/blob/master/FAQ.md
We can use 'com.github.instacart.truetime-android:library-extension-rx:kg~fix~sync_to_atomic-SNAPSHOT' to get that branch compiled.

@atrifat

This comment has been minimized.

Show comment
Hide comment
@atrifat

atrifat Mar 8, 2018

I got the same problem and the solution from @Mugurell works. Is the branch from @kaushikgopal not merged yet in master or next release 3.3.1?

atrifat commented Mar 8, 2018

I got the same problem and the solution from @Mugurell works. Is the branch from @kaushikgopal not merged yet in master or next release 3.3.1?

@chris6647

This comment has been minimized.

Show comment
Hide comment
@chris6647

chris6647 Mar 8, 2018

We have switched to https://github.com/AllanHasegawa/Tempo which, for now at least, has not given any of the issues we've had with truetime.

chris6647 commented Mar 8, 2018

We have switched to https://github.com/AllanHasegawa/Tempo which, for now at least, has not given any of the issues we've had with truetime.

@kaushikgopal

This comment has been minimized.

Show comment
Hide comment
@kaushikgopal

kaushikgopal May 28, 2018

Collaborator

PR #80 is up and should be merged shortly.

Collaborator

kaushikgopal commented May 28, 2018

PR #80 is up and should be merged shortly.

@kaushikgopal

This comment has been minimized.

Show comment
Hide comment
@kaushikgopal

kaushikgopal May 29, 2018

Collaborator

master should have the required fixes now. If you're eager to take this before it hits 3.4 try:

implementation com.github.instacart.truetime-android:library-extension-rx:09087b6a6e

Collaborator

kaushikgopal commented May 29, 2018

master should have the required fixes now. If you're eager to take this before it hits 3.4 try:

implementation com.github.instacart.truetime-android:library-extension-rx:09087b6a6e

@kaushikgopal kaushikgopal added awaiting feedback and removed wip labels May 29, 2018

@atrifat

This comment has been minimized.

Show comment
Hide comment
@atrifat

atrifat May 29, 2018

@kaushikgopal LGTM, finally merged. I have already implemented it on my project. Thanks.

atrifat commented May 29, 2018

@kaushikgopal LGTM, finally merged. I have already implemented it on my project. Thanks.

@kurilyonok

This comment has been minimized.

Show comment
Hide comment
@kurilyonok

kurilyonok Jun 6, 2018

Hi @kaushikgopal ! I'm experiencing the same issue with slow wifi (( And emulators as well.. Looking forward to update version 3.4! Thanks man, great lib!

kurilyonok commented Jun 6, 2018

Hi @kaushikgopal ! I'm experiencing the same issue with slow wifi (( And emulators as well.. Looking forward to update version 3.4! Thanks man, great lib!

@MarkVillacampa

This comment has been minimized.

Show comment
Hide comment
@MarkVillacampa

MarkVillacampa Aug 24, 2018

The original issue is not fixed. IPv6 addresses are not being resolved in the emulator and possibly in some devices as stated by @sreejithbnaick.

The problem mentioned in #337286921, for which this issue was closed, has been addressed, but it is not the original issue. Should I open a new open or can you reopen this one?

MarkVillacampa commented Aug 24, 2018

The original issue is not fixed. IPv6 addresses are not being resolved in the emulator and possibly in some devices as stated by @sreejithbnaick.

The problem mentioned in #337286921, for which this issue was closed, has been addressed, but it is not the original issue. Should I open a new open or can you reopen this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment