Skip to content

Bloop server sometimes becomes unresponsive #2594

@harpocrates

Description

@harpocrates

Sorry for the very generic title - I'm just a bit at a loss to figure out what information would be most helpful to collect.

The failure

The failure mode is weird: the Bloop server becomes very slow to respond to requests, and at some point seems to not respond at all

  • Metals eventually catches on (warns you that your compile has been taking a really long time), and marks the Bloop icon in the corner as not responding anymore
  • My custom Bloop clients also just stop getting responses
  • Even just doing bloop projects from the CLI becomes super slow or hangs indefinitely!

My setup that runs into this...

Some maybe useful context:

  • There is often more than one project open
  • There are usually several Bloop clients per project
    • One of those is Metals
    • Others are coming from some custom code. They:
      • list out build targets
      • trigger compilation
      • sometimes hotload some of those compiled outputs
      • these are periodically restarted and probably sometimes leave the Bloop connection without proper shutdown. That's something I plan on fixing, but I would expect Bloop as a whole to be resistant to this sort of thing...
    • I would expect these clients to probably be requesting compilation around the same time (they all indirectly are triggering on file system events)
  • I am programmatically changing Bloop JSON configs. For some extra sanity check, I also restart metals at the same time.
  • Issues start only after there are a number of connections (or re-connections) that have occurred
  • This all runs without internet access, though I'm doubtful this is the issue (if I stick to a single project and don't run any custom stuff, Bloop works just fine!)
  • Anecdotally, I only noticed this when bumping to the latest Bloop version 2.0.8 and Metals 1.5.0 beginning of last week

Some logs

(Anything else worth collecting here?)

Metals logs when I try to reconnect to Bloop as prompted
2025.01.31 09:31:49 ERROR Failed to connect with build server, no functionality will work.
java.lang.RuntimeException: Timeout (10 seconds) while waiting for BSP socket to be created in /home/alec/.local/share/scalacli/bloop/bsp/8637-1
	at scala.sys.package$.error(package.scala:27)
	at bloop.rifle.internal.Operations$$anon$1.openSocket(Operations.scala:422)
	at scala.meta.internal.metals.BloopServers.create$1(BloopServers.scala:384)
	at scala.meta.internal.metals.BloopServers.openConnection$1(BloopServers.scala:400)
	at scala.meta.internal.metals.BloopServers.$anonfun$connect$5(BloopServers.scala:413)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:687)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:467)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.lang.Thread.run(Thread.java:840)
Bloop daemon logs
Bloop server PID: 2638
Ignoring SIGINT
Will truncate output file /home/alec/.local/share/scalacli/bloop/daemon/output every 5 minutes
Unable to load nailgun-version.properties.
NGServer [UNKNOWN] started on local socket /home/alec/.local/share/scalacli/bloop/daemon/socket.
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop
/home/alec/projects/MyProject1
/home/alec/projects/MyProject1
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
09:15:17.873 [NGSession 10: (idle) (NGCommunicator orchestrator)] ERROR c.martiansoftware.nailgun.NGServer - Nailgun client read future raised an exception
java.net.SocketException: Connection reset
	at java.base/sun.nio.ch.SocketChannelImpl.throwConnectionReset(SocketChannelImpl.java:394)
	at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:426)
	at libdaemonjvm.Util$$anon$1$$anon$2.read(Util.scala:19)
	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
	at java.base/java.io.InputStream.read(InputStream.java:218)
	at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:81)
	at java.base/java.io.DataInputStream.readInt(DataInputStream.java:381)
	at com.martiansoftware.nailgun.NGCommunicator.readChunkImpl(NGCommunicator.java:497)
	at com.martiansoftware.nailgun.NGCommunicator.readChunk(NGCommunicator.java:480)
	at com.martiansoftware.nailgun.NGCommunicator.lambda$null$0(NGCommunicator.java:209)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/projects/MyProject2
/home/alec/.local/share/scalacli/bloop
/home/alec/.local/share/scalacli/bloop

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA defect or misbehaviour.build serverAny issue or pull request that has to do with hot compilers or BSP.needs more info

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions