Repro steps:
bloop bsp --socket=<socket> and kill with C-c. Do this four timesbloop about - nothing happens, the server hangedHere's the dockerfile showing this issue.
FROM openjdk:8
RUN apt-get update
RUN apt-get install -y curl
RUN curl -s -L -O https://git.io/coursier
RUN chmod +x coursier
RUN ./coursier bootstrap --quiet -f --deterministic --output launcher ch.epfl.scala:bloop-launcher_2.12:1.2.5
RUN ./launcher --skip-bsp-connection 1.2.5 && \
(rm -f /tmp/socket && timeout 2 ~/.bloop/bloop bsp --socket /tmp/socket; exit 0) && \
(rm -f /tmp/socket && timeout 2 ~/.bloop/bloop bsp --socket /tmp/socket; exit 0) && \
(rm -f /tmp/socket && timeout 2 ~/.bloop/bloop bsp --socket /tmp/socket; exit 0) && \
(rm -f /tmp/socket && timeout 2 ~/.bloop/bloop bsp --socket /tmp/socket; exit 0) && \
~/.bloop/bloop about
Thanks for reproducing! I've never been able to reliably reproduce this myself but I believe I have hit on the same issue in Metals. At least, it's not uncommon for me to run brew services restart bloop to fix connection issues.
For the record, I can reproduce this. But I don't actually have to kill anything. I can just start four active bloop bsp commands on different ports, and the fifth will not work.
Is it likely that threads get assigned to BSP clients from a pool of 4, that killing bloop bsp doesn't release the thread, so we end up with thread starvation?
Is it likely that threads get assigned to BSP clients from a pool of 4, that killing
bloop bspdoesn't release the thread, so we end up with thread starvation?
Yes, that's exactly the case. Let me see how I can cut a hot fix for this bug.
By the way, if the session is not killed, but exits after client disconnection, the problem doesn't occur.
Aha, I figured this had to do with the proper resource releasing when the process exits unexpectedly.
A fix for this is coming.
Fixed in master
Most helpful comment
A fix for this is coming.