-
Notifications
You must be signed in to change notification settings - Fork 115
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
Max limit of loops per a lifetime of a process #151
Comments
I had the idea to abuse the address of reactor"s However, would it be acceptable to use |
We currently document a guarantee that ids are globally unique, and addresses would allow for recycling, so we may not be able to base this off an address. |
Was the documentation change actually released? Furthermore, tokio-core"s interface is said to not be stable yet anyway, so it could be decided the guarantee relaxation is OK… The problem of never reusing the IDs is that they either can run out or need to be growing in size over time and neither is very nice. But maybe using 64bit numbers makes the problem of running out an academic problem (to run out in 10 years of runtime of the program, it would have to construct 58494241735 new loops every second, if I count correctly). |
It"s been released, yes, but I feel like worry about the maximum number of loops for the lifetime of a process is a purely theoretical problem. No practical program will ever exhaust the 64-bit space and we can easily add a 64-bit counter (or larger) behind a global lock. |
I"m opening this to keep track, not that it"d need fixing right away.
As discussed in #149, there"s an
usize
counter increased every time a new loop is created. This can get depleted if, for example, a new loop is created for every file downloaded (not the cleverest way to implement a web crawler, but not impossible either). The depletion can happen in order of days on 32bit platforms.The easy solution is to use a bigger integer (
u64
), but its atomic variant is not yet stable (rust-lang/rust#32976).The text was updated successfully, but these errors were encountered: