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
Reducing use of F.unsafeRunSync #2735
Comments
I thought blaze internals required at least two threads, but it's possible we overcame that. I haven't tried, but I can't certify a single thread as viable. That said, I think making this async would be reasonable. There's no guarantee that |
Regarding #2695, I think we have to set the I would also log any lefts in the |
Thinking about it some more, even though using >1 threads solves the immediate deadlock, there is always the (very small but non-zero) risk of all worker threads (4 on a 4-core system?) being involved in cleaning up a connection at the same time and then deadlocking as none of them are giving up their thread until they can run their effect on another one. I'm not sure about coding style and error logging specifics of http4s, so I hope someone else can make the PR or change. Thank your for your quick replies Ross. |
Your proposal looks close to good to me, if you want to try a PR. I'd say:
unsafeRunAsync {
case Left(t) => logger.error(t)("Error setting dead signal")
case Right(_) => ()
}
If you don't have time, I can in the next day or two, but I've got a few others in flight. |
I don't know what it is about using I've created a pull request, but it's small so feel free to just add the change into some other work you're doing. I thought I could get by with 0.20.6 but am now using a local 0.20.7-SNAPSHOT. |
This looks like it has been already addressed? |
Yeah, CE3 cleared that up. |
(See also my last comment in #2695)
When running with a very low number of threads in order to provoke deadlocks that could manifest under load in production I run into a deadlock in
websocket/Http4sWSStage.scala
:where the
unsafeRunSync
is called, viastageShutdown
all the way back tosendClose
from within an effect, and can not synchronously rundeadSignal.set
as there are no more threads available:Is there a reason this is done synchronously, as with:
I can run my app with a single thread.
The text was updated successfully, but these errors were encountered: