metals icon indicating copy to clipboard operation
metals copied to clipboard

Presentation Compiler infinite loop

Open vzmerr opened this issue 2 years ago • 4 comments

Describe the bug

The presentation compiler was indefinitely running and this was in metals log:

2022.08.05 09:28:31 INFO  tracing is disabled for protocol LSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/.metals/lsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/lsp.trace.json
2022.08.05 09:28:32 INFO  logging to file /Users/izimmer/Documents/metals/.metals/metals.log
2022.08.05 09:28:32 INFO  Started: Metals version 0.11.7+79-d2ab7248-SNAPSHOT in workspace '/Users/izimmer/Documents/metals' for client Visual Studio Code 1.69.2.
2022.08.05 09:28:33 WARN  Flyway upgrade recommended: H2 2.1.214 is newer than this version of Flyway and support has not been tested. The latest supported version of H2 is 2.1.210.
2022.08.05 09:28:35 INFO  time: initialize in 2.8s
2022.08.05 09:28:37 INFO  Attempting to connect to the build server...
2022.08.05 09:28:37 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:37 INFO  skipping build import with status 'Installed'
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  Attempting to connect to the build server...
2022.08.05 09:28:42 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:42 INFO  Attempting to connect to the build server...
2022.08.05 09:28:42 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/project/project/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/project/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  time: Connected to build server in 5.85s
2022.08.05 09:28:42 INFO  Connected to Build server: Bloop v1.5.3
2022.08.05 09:28:46 INFO  no build target found for /Users/izimmer/Documents/metals/tests/cross/src/main/scala/tests/BaseCompletionSuite.scala. Using presentation compiler with project's scala-library version: 3.1.3
2022.08.05 09:28:46 INFO  time: code lens generation in 8.64s
2022.08.05 09:28:47 INFO  time: Imported build in 0.52s
2022.08.05 09:28:57 INFO  time: indexed workspace in 10s
2022.08.05 09:48:01 INFO  compiling cross-test (1 scala source)
2022.08.05 09:48:08 INFO  time: compiled cross-test in 7.06s
Aug 05, 2022 9:55:30 AM org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint notify
INFO: Unsupported notification method: $/setTrace

And this was in metals output:

Java home: /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home
Metals version: 0.11.7+79-d2ab7248-SNAPSHOT
2022.08.05 09:28:32 INFO  logging to file /Users/izimmer/Documents/metals/.metals/metals.log
2022.08.05 09:28:32 INFO  Started: Metals version 0.11.7+79-d2ab7248-SNAPSHOT in workspace '/Users/izimmer/Documents/metals' for client Visual Studio Code 1.69.2.
2022.08.05 09:28:33 INFO  Flyway Community Edition 9.0.4 by Redgate
2022.08.05 09:28:33 INFO  See what's new here: https://flywaydb.org/documentation/learnmore/releaseNotes#9.0.4
2022.08.05 09:28:33 INFO  
2022.08.05 09:28:33 INFO  Database: jdbc:h2:file:/Users/izimmer/Documents/metals/.metals/metals (H2 2.1)
2022.08.05 09:28:33 WARN  Flyway upgrade recommended: H2 2.1.214 is newer than this version of Flyway and support has not been tested. The latest supported version of H2 is 2.1.210.
2022.08.05 09:28:33 INFO  Successfully validated 4 migrations (execution time 00:00.044s)
2022.08.05 09:28:33 INFO  Current version of schema "PUBLIC": 4
2022.08.05 09:28:33 INFO  Schema "PUBLIC" is up to date. No migration necessary.
2022.08.05 09:28:35 INFO  time: initialize in 2.8s
Initializing Scala Debugger
Release notes was not shown: not showing release notes since they've already been seen for your current version
2022.08.05 09:28:37 INFO  Attempting to connect to the build server...
2022.08.05 09:28:37 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:37 INFO  skipping build import with status 'Installed'
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  Attempting to connect to the build server...
2022.08.05 09:28:42 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:42 INFO  Attempting to connect to the build server...
2022.08.05 09:28:42 INFO  Bloop uses /Users/izimmer/.jabba/jdk/[email protected]/Contents/Home defined at /Users/izimmer/.bloop/bloop.json
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/project/project/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /Users/izimmer/Documents/metals/project/.metals/bsp.trace.json or /Users/izimmer/Library/Caches/org.scalameta.metals/bsp.trace.json
2022.08.05 09:28:42 INFO  time: Connected to build server in 5.85s
2022.08.05 09:28:42 INFO  Connected to Build server: Bloop v1.5.3
2022.08.05 09:28:46 INFO  no build target found for /Users/izimmer/Documents/metals/tests/cross/src/main/scala/tests/BaseCompletionSuite.scala. Using presentation compiler with project's scala-library version: 3.1.3
2022.08.05 09:28:46 INFO  time: code lens generation in 8.64s
2022.08.05 09:28:47 INFO  time: Imported build in 0.52s
2022.08.05 09:28:57 INFO  time: indexed workspace in 10s
2022.08.05 09:48:01 INFO  compiling cross-test (1 scala source)
2022.08.05 09:48:08 INFO  time: compiled cross-test in 7.06s

Expected behavior

Presentation compiler should not run indefinitely

Operating system

macOS

Editor/Extension

No response

Version of Metals

0.11.7+79-d2ab7248-SNAPSHOT

Extra context or search terms

infinite loop presentation compiler

vzmerr avatar Aug 05 '22 08:08 vzmerr

Thanks for reporting! How did you notice that it was running infinitely? Could you maybe get a stack trace next time? For example using Visualvm? I think the issue might be related to 3.1.3 bug and is fixed in 3.2.0

tgodzik avatar Aug 05 '22 08:08 tgodzik

How did you notice that it was running infinitely?

There was a pop up in the bottom right corner which was was showing some message like "Presentation compiler running for 17m" and the number of minutes were just keeping increasing.

Each time this happens, it does not end even after a long period, such as an hour, unless I just hit cancel

vzmerr avatar Aug 05 '22 08:08 vzmerr

For example using Visualvm

Could you please point to a link for its usage?

vzmerr avatar Aug 05 '22 08:08 vzmerr

Seems like the same issue I've seen. Might be connected to hanging presentation compiler, maybe when we kill it the pop up doesn't close.

Visualvm is here https://visualvm.github.io/

tgodzik avatar Aug 05 '22 09:08 tgodzik

I think the issue might have been a race condition. I moved the notification elsewhere, so this should not show up again.

tgodzik avatar Sep 06 '22 12:09 tgodzik