-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
poll_fd returns earlier than timeout.....once in a while. #3015
Comments
So does sleep() - seems like an issue with sleep (Timer) rather than poll_fd.
|
@loladiro fixed the julia part of this in 95b6349 The upstream libuv bug means that the duration argument gets reduced by 1 millisecond (the minimum resolution of the timer) when the timeout is computed. We could provide a temporary hack by incrementing the given duration by 1. |
Wonder if that could have anything to do with #3034? |
I'm not sure how this (a libuv bug that reduces timeouts by up to 1 ms) has anything to do with the system picking up the wrong library. |
Bugs like this aren't always obvious. I'm looking for anything a) weird, b) non-deterministic, c) kicking in with multiple processes. This seems to fit that very vague bill. Plus, I got you to look at the other issue, so I win :-) |
Yes, yes and yes. Sorry, I'll work on this as soon as I'm out of exams (god damn homology theory), unless somebody wants to tackle it first. |
No hurry, @loladiro. Have fun with your semester system, I'm barely halfway through my quarter. :) |
While we're at it, we should normalize all the time-related functions to accept seconds instead of milliseconds. |
If by seconds, you mean Float64, then I feel it should be the other way around. All system calls use integers for time values, and the rounding up behavior of int() functions can lead to bugs in the translation of Float64 to the system API parameters if the programmer is not careful and aware of the same. Better to standardize on |
Nobody said we have to round up. We could even require that I think breaking it into two arguments is too hard to use. If we want to base it on integers, perhaps we should use a type like in |
We can always have some time structure that represents seconds + milliseconds (or nano or whatever), but these should all accept floating-point seconds for ease of use. The second is the SI unit for time and the most intuitive, so that really what we should standardize on IMO. Writing |
Note that while I added 1 on Unix according to the libuv developers, this trick will not work on Windows and there is no way to ensure that the timer does not exit early. |
Can we internally have the timer go off, realize it's early and reset itself with the remaining amount of time? |
Maybe. I need to discuss this with one of the libuv windows developers who wasn't on IRC when I talked to them. |
Actually according to the libuv developer whom I just spoke to, he managed to fix this on Windows, so maybe the issue is gone. |
That would be great. |
For the trivial case of a 1 millisecond timeout, the following looping code usually throws an exception after around 40-50 poll_fd calls...
cc: @loladiro
The text was updated successfully, but these errors were encountered: