-
Notifications
You must be signed in to change notification settings - Fork 53
Plugin creates an unreasonable amount of "New I/O worker #NN" threads #144
Comments
fyi @farmdawgnation |
Okay, this seems likely to come down to a semantic change in We can add some manual synchronization around the call to |
For sbt-pgp, I fixed the problem by migrating to Gigahorse - sbt/sbt-pgp@11963a2 |
Let me know if there's anything I can do from the Dispatch side. I've seen this kind of issue before, but we don't really layer much special on top of AHC, so I suspect the root bug is there. I can't see what version of Dispatch you're using, but our latest is 0.14 and AHC has been doing a lot of house cleaning. You might also get some boost by upgrading. |
The default behaviour in dispatch is to create a new AHC client for The obvious thing a client might do here is share a So the action is to determine and document thread-safety, and at the same time document the lifecycle of the threads and the need to call The other awkward part about the dispatch API is in customizing the configuration of AHC while retaining any defaults that dispatch starts with. AFAICT you can do only do with: val customHttp = {
val prototypeHttp = Http()
try {
http.configure(builder => builder.setIOThreadMultiplier(1))
} finally prototypeHttp.shutdown()
} That's clunky and wasteful (it creates threads just to destroy them) Perhaps it makes sense to expose |
I'll reply to each point to the best of my ability without having the code open in front of me this moment...
I can do some digging to determine if we permit this. I suspect this behavior is just a carry-over from the dispatch-classic days, but I will admit that it does make me a bit leery for two
I fixed this wart a few months ago in 0.13.x. Once you upgrade to that version or higher, |
Discussion continuing from sbt/sbt#3962
sbt-bintray uses dispatch, which uses AsyncHttpClient, which uses Netty. The combination of usage pattern and defaults within this stack seems to result in a large number of backgrounds threads (~150 in the sample build I looked at sbt/zinc) laying in wait for some HTTP traffic to mediate. I
This is undesirable on a few counts: each of these threads consumes a little memory for the stack and they make it a little harder to scroll through thread dumps of SBT.
My expectation is that the plugin should not consume resources until it first does some work, at which point it should only create a number of threads in the range of 0-2x the CPU count. Ideally, these threads would be removed from the pool after a period of inactivity.
The text was updated successfully, but these errors were encountered: