-
-
Notifications
You must be signed in to change notification settings - Fork 132
StreamSelectLoop timer interval limit fix (on 32-bit systems) #23
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
StreamSelectLoop timer interval limit fix (on 32-bit systems) #23
Conversation
I have yet to do some more in-depth testing, but on first sight the changes LGTM 👍 Afaict 32-bit systems are becoming increasingly less common, yet this change affects all versions. Is this worth considering, i.e. is the overhead even noticeable? A slightly less intrusive alternative might be to just cap the maximum |
2147 is just over 35 minutes. Tbh if you need a timer to run in 10 minutes or later you maybe should consider a more persistent storage of your timer event. For example dead letter exchanges in rabbitmq. Capping it to |
Unfortunately this PR is technically a BC break, as consumers could depend on the I think it makes sense to fix the underlying issue, but we won't be able merge this into the v0.4 series like this. |
Ping @alexmnv, what do you think about the above comments? Also, may I ask you to rebase this on the new "0.4" branch so we get this in for the upcoming v0.4.3 release? |
return stream_select($read, $write, $except, $timeout === null ? null : 0, $timeout); | ||
$tv_sec = $timeout === null ?: floor($timeout); | ||
// convert the fractional part of $timeout to microseconds | ||
$tv_usec = $timeout === null ?: round(fmod($timeout, 1) * self::MICROSECONDS_PER_SECOND); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When $timeout === null
, both $tv_sec
and $tv_usec
will become true
because of the elvis operator.
This should be
$tv_sec = $timeout === null ? null : floor($timeout);
// convert the fractional part of $timeout to microseconds
$tv_usec = $timeout === null ? null : round(fmod($timeout, 1) * self::MICROSECONDS_PER_SECOND);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsor You're right. I missed it.
Fix timer interval limit issue in \React\EventLoop\StreamSelectLoop (issue #19)
On 32-bit systems it's not possible to set a timer interval higher than 2147 seconds.