Replies: 7 comments 10 replies
-
maybe this explains? what is the workaround?
|
Beta Was this translation helpful? Give feedback.
-
This is because your timer is created outside of the runtime. This works: |
Beta Was this translation helpful? Give feedback.
-
Yes! of course after posting this question figured it out (had to go through the stack trace and read the documentation of the internals!) Maybe we can add a check that this is the case and have an easy to read message? Another issue I have now (unrelated possibly) is that the test will complete but then I will get a message like:
|
Beta Was this translation helpful? Give feedback.
-
(I have a spawned task in the function being tested + a timed task)
|
Beta Was this translation helpful? Give feedback.
-
You are dropping a runtime from inside a runtime. Did you create two runtimes? |
Beta Was this translation helpful? Give feedback.
-
It might have been created deeper inside. Is there some constraint on how many runtimes to have? Should runtimes be shared across modules / crates? if so how ? |
Beta Was this translation helpful? Give feedback.
-
There's no constraint on the number of runtimes, but you can only use one runtime at the time on a single OS thread. It is generally more performant to share a single runtime, and most projects should not create more than one. |
Beta Was this translation helpful? Give feedback.
-
similar to #2316
test code is as follows:
This runs as expected
But with timers if they expire it will crash for me:
Example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7b24d2085a3127c2e7f073091c90eff7
Beta Was this translation helpful? Give feedback.
All reactions