-
Notifications
You must be signed in to change notification settings - Fork 735
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
Work around 32 bits epoll_wait() bug #1349
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Officially we don't support kernels that old. That said since the change is rather small I would be OK with it it. @carllerche, @kleimkuhler what are your thoughts? @bnoordhuis to fix the CI you can use the following patch. It's complaining about diff --git a/src/sys/unix/selector/epoll.rs b/src/sys/unix/selector/epoll.rs
index eb7cbe3..6955848 100644
--- a/src/sys/unix/selector/epoll.rs
+++ b/src/sys/unix/selector/epoll.rs
@@ -49,11 +49,11 @@ impl Selector {
// A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX / CONFIG_HZ
// (approx. 30 minutes with CONFIG_HZ=1200) effectively infinite on 32 bits
// architectures. The magic number is the same constant used by libuv.
- const MAX_SAFE_TIMEOUT: u128 = if cfg!(target_pointer_width = "32") {
- 1789569
- } else {
- libc::c_int::max_value() as u128
- };
+ #[cfg(target_pointer_width = "32")]
+ const MAX_SAFE_TIMEOUT: u128 = 1789569;
+ #[cfg(not(target_pointer_width = "32"))]
+ const MAX_SAFE_TIMEOUT: u128 = libc::c_int::max_value() as u128;
let timeout = timeout
.map(|to| cmp::min(to.as_millis(), MAX_SAFE_TIMEOUT) as libc::c_int) |
A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX / CONFIG_HZ (approx. 30 minutes with CONFIG_HZ=1200) effectively infinite on 32 bits architectures. The magic number is the same constant used by libuv, see commit libuv/libuv@d1b5008e76.
Thomasdezeeuw
approved these changes
Sep 28, 2020
👍 |
Thanks @bnoordhuis |
@carllerche is this something we want to backport to v0.6? |
Thomasdezeeuw
pushed a commit
to Thomasdezeeuw/mio
that referenced
this pull request
Sep 29, 2020
A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX / CONFIG_HZ (approx. 30 minutes with CONFIG_HZ=1200) effectively infinite on 32 bits architectures. The magic number is the same constant used by libuv, see commit libuv/libuv@d1b5008e76.
Thomasdezeeuw
pushed a commit
to Thomasdezeeuw/mio
that referenced
this pull request
Dec 1, 2020
A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX / CONFIG_HZ (approx. 30 minutes with CONFIG_HZ=1200) effectively infinite on 32 bits architectures. The magic number is the same constant used by libuv, see commit libuv/libuv@d1b5008e76.
Thomasdezeeuw
pushed a commit
that referenced
this pull request
Dec 1, 2020
A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX / CONFIG_HZ (approx. 30 minutes with CONFIG_HZ=1200) effectively infinite on 32 bits architectures. The magic number is the same constant used by libuv, see commit libuv/libuv@d1b5008e76.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A bug in kernels < 2.6.37 makes timeouts larger than LONG_MAX /
CONFIG_HZ (approx. 30 minutes with CONFIG_HZ=1200) effectively
infinite on 32 bits architectures. The magic number is the same
constant used by libuv, see commit libuv/libuv@d1b5008e76.
If you don't care about kernels that old, I'm a-okay with closing this. No hard feelings.