-
Notifications
You must be signed in to change notification settings - Fork 141
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
Investigate runtime setup in roles #1390
Comments
I'll look into this |
started with the |
@jbesraa can you elaborate more on the motivations for this investigation? I assume this is a potential solution to #1266 and #1320, correct? however, while discussing with @GitGab19 we started to wonder if there's other ways to deal with these problems. for example, killing roles on ITs could be potentially solved by the alternatively, the ghost tasks could also be potentially solved by deeper debugging the threading model of the roles (which would allow us to narrow down what is the actual root cause problem) so while this |
Shutting down the program does not exit all the running tasks in the background. The main motivation is allowing us to control all async tasks in a more precise way and also allow us to expose sync api and not only async |
If that's the reason, I would say that we need to separate more clearly the issues and the goals. For example, I would open a specific issue for debugging the threading model of the roles. I don't think that trying to sort out What do you think @jbesraa? |
Well, the problem is we dont have any threading model currently. runtime + threading/tasks stuff are all the same. if you look in the link above you can see that instead of doing #[tokio::main] the runtime is started manually and then it is being used to spawn tasks, and also implemented functionality to cancel each task using tokio::select and tokio channels. Channels are used in order to pass data/state across async jobs while runtime/tasks are responsible for running async jobs. So currently I dont do any work on the channels, just working on a functionality to allow us to manage the runtime/tasks in a precise way. |
I'm pretty sure that what you're doing in the link posted above should be exactly what If we're experiencing the issue we're discussing, it probably mean it's something else, otherwise what could it be in your opinion?
That's why I think a better approach would be to deeply dive into how every role currently manages threads. So that we can get a proper overview of the current situation before trying to solve everything with a single shot. And this investigation would be a task to assign to a single person, as I was suggesting above. |
(1) is incorrect - tokio does not guarantee async tasks shutdown when you stop rt.
sorry, I dont get what you mean?
as mentioned above, roles dont manage any thread/async tasks - they just spawn them. what kind of overview do you think is missing? |
I guess, what @GitGab19 meant is the runtime exits when all the task completes. The reason for runtime not exiting is because the task are blocking the runtime, and because of which I guess, with thread model he meant how we are managing our tasks. |
Currently we use
tokio::main
and as a result the code behaves differently in different environments (test runtime for example). Investigate if we can introduce theruntime
in thelib
code. Ifruntime
code moves tolib
, we could allow users to provide aruntime
input in case they are interested in running multiple roles on the sameruntime
or thelib
code can take care of creating its own runtime.The text was updated successfully, but these errors were encountered: