jeromq icon indicating copy to clipboard operation
jeromq copied to clipboard

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

Open j1228415981 opened this issue 1 year ago • 4 comments

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

j1228415981 avatar Oct 25 '24 02:10 j1228415981

In english please, what are you talking about ?

fbacchella avatar Oct 25 '24 06:10 fbacchella

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

trevorbernard avatar Oct 28 '24 12:10 trevorbernard

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.

fbacchella avatar Oct 28 '24 13:10 fbacchella

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.

trevorbernard avatar Oct 28 '24 18:10 trevorbernard