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

修复系统时间跳变引起的长时间无返回 #1004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

j1228415981
Copy link

系统时间突然跳到过去某个时间,会导致这个 timeout 非常大,引起长时间没有返回
timeout = (int) (end - Clock.nowMS())

@fbacchella
Copy link
Contributor

In english please, what are you talking about ?

@trevorbernard
Copy link
Member

@j1228415981 I translated your PR but I still don't understand the problem it aims to solve, if any.

@fbacchella
Copy link
Contributor

Clock.nowMS() uses System.currentTimeMillis(), which uses one of the internal OS clock.
System.nanoTime() uses System.nanoTime(), which is an internal mesure of the VM.

If you set the time of the OS (which should never be done) the first one fails to mesure elapsed time. And so the timeout fails. But any way, i don’t think the patch is good, it uses a division, that is a heavy operation that should be avoided. Is it the only place where a timeout is handled in such a way in the all library ? That’s a quick fix solution, not a comprehensive one.

@trevorbernard
Copy link
Member

We shouldn't pass judgement on a valid PR according to the C4, but this isn't a valid PR because it doesn't solve an agreed upon problem.

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

Successfully merging this pull request may close these issues.

3 participants