Bloop: Bloop hangs after 4 broken bsp sessions ended

Created on 1 Mar 2019  路  7Comments  路  Source: scalacenter/bloop

Repro steps:

  1. Start bloop server
  2. Start bloop bsp session bloop bsp --socket=<socket> and kill with C-c. Do this four times
  3. Try bloop about - nothing happens, the server hanged

Here'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
bug build server has fix

Most helpful comment

A fix for this is coming.

All 7 comments

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 bsp doesn'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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jvican picture jvican  路  5Comments

ayoub-benali picture ayoub-benali  路  4Comments

olafurpg picture olafurpg  路  8Comments

jvican picture jvican  路  3Comments

aywengo picture aywengo  路  3Comments