Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metals through VS Code reproducibly stops working #1644

Closed
jdegoes opened this issue Apr 18, 2020 · 20 comments
Closed

Metals through VS Code reproducibly stops working #1644

jdegoes opened this issue Apr 18, 2020 · 20 comments
Assignees
Labels
bug Something that is making a piece of functionality unusable
Milestone

Comments

@jdegoes
Copy link

jdegoes commented Apr 18, 2020

Describe the bug

Metals stops compiling ZIO after anywhere from a few hours to a few days of continuous use.

To Reproduce

Steps to reproduce the behavior:

  1. Clone https://github.com/zio/zio
  2. Edit the files repeatedly
  3. Engage in Git-related interactions (optional?)
  4. Re-import the SBT project when prompted (optional?)
  5. Metals will eventually stop compiling, sometimes with old (no longer relevant) �errors reported

I have observed this to happen with smaller repositories, as well as larger ones like ZIO.

To fix this problem, it is often necessary to:

  1. Shut down VS Code entirely
  2. Kill all processes listed with JPS
  3. rm -rf .bloop .metals
  4. Relaunch VS Code and reimport the SBT build

Sometimes, only some of these steps are necessary to restore a working environment.

Expected behavior

Ideally, Metals should continue to work for hours and days of use at a time.

Screenshots

An example of the kind of error messages produced by Metals:

ERROR code navigation does not work for the file '/Users/john/Documents/git/scalaz-zio-alpha/core/shared/src/main/scala/zio/internal/FiberContext.scala' because the build target coreJVM is being compiled. Wait until compilation is finished and try again.

In the above, no amount of waiting solves the problem:

INFO  Deduplicating compilation of stacktracerJS from bsp client 'Metals 0.8.3' (since 2h 3m 45.77s)

This is not always the error produced (other times there are other errors).

2020-04-18 09:57 java[44509] (FSEvents.framework) FSEventStreamStart: register_with_server: ERROR: f2d_register_rpc() => (null) (-21)

It's not clear if these errors have anything to do with the issue.

Installation:

  • Operating system: macOS
  • Editor: Visual Studio Code
  • Metals extension version: v1.8.6

Additional context

Search terms

@ColOfAbRiX
Copy link

ColOfAbRiX commented Apr 18, 2020

I'm experiencing a very similar problem and I was about to create an issue myself.

What I see is a general freeze of the features of metals like the autocompletion not working, the errors not updating while I can compile the code succesfully from SBT console. I do not have a list of steps to reproduce the issue because it seems it happens randomly and I can solve it by removing .metals and .bloop directories.

For me this issue started with the upgrade from 0.8.3 to 0.8.4

Installation:

  • Windows 10
  • VS Code 1.44
  • Metals 0.8.4

Screenshot:

screenshot

@jdegoes
Copy link
Author

jdegoes commented Apr 18, 2020

/cc @adamgfraser, who I know has had this issue as well.

@tgodzik
Copy link
Contributor

tgodzik commented Apr 20, 2020

Thanks for reporting! Fixing this is certainly a priority, since we did notice it happening more frequently.

@ColOfAbRiX You can revert the server version to 0.8.3 by hand for now until we manage to fix it.

@tgodzik tgodzik added the bug Something that is making a piece of functionality unusable label Apr 20, 2020
@tgodzik tgodzik self-assigned this Apr 20, 2020
@tgodzik tgodzik added this to the Metals v0.9 milestone Apr 20, 2020
@adpi2
Copy link
Member

adpi2 commented Apr 22, 2020

I had some recurring problem with Metals as well and I remember that stopping the Bloop service and restarting it with bloop server has helped me at some point.

I believe that the incremental compilation in Bloop with Metals is a serious candidate. I would like to reproduce it and investigate further.

@jdegoes could you please share with us:

  • your version of the sbt-bloop plugin, in your project/metals.sbt file
  • the output of bloop about on your machine

@tgodzik
Copy link
Contributor

tgodzik commented Apr 22, 2020

@adpi2 I was looking at this during this week and the current action plan I came up with is:

  • we've noticed 2 issues in Bloop connected to deduplication that will be fixed soon
  • add a clean option inside Metals, which might help with problematic scenarios
  • better detect disconnections: fix Missing bloop disconnection alert when exiting bloop #1354
  • MAYBE: reconenct to bloop on a regular basis

@tgodzik tgodzik modified the milestones: Metals v0.9, Metals v0.9.1 Apr 30, 2020
@davidpdrsn
Copy link

Sorry if this isn't related but I often get this:

❯ bloop test shared -o dk.undo.factories.FactoriesSpec
Deduplicating compilation of shared-test from cli client 'bloop-cli' (since 2.274s)
[E] /Users/david/dev/major/backend-scala/.bloop/shared/bloop-bsp-clients-classes/bloop-cli/dk/undo/cronductor/TestJob.class

Nothing happens after that. Running the command again gives the same output. rm -rf .bloop .metals and reimport is the only solution I've found.

@tgodzik
Copy link
Contributor

tgodzik commented May 15, 2020

We've already done some improvements and I personally haven't encountered any hanging compilations on 0.9.0 version. Please do report if anything like that happens again, otherwise I will close this issue in the next two weeks.

@davidpdrsn I think this might have something to do with running CLI and Metals at the same time. Could you run compile --verbose if you encounter this next time? We should most likely report this in Bloop itself. This might have something to do with known zinc issues and it doesn't look related to the hanging compilations.

rm -rf .bloop .metals and reimport is the only solution I've found.

As a current workaround you could try to do bloop clean or alternatively removing just the directories inside .bloop + reload window as the nuclear option. You will not need to reimport the build this way, because the json files should still be in place.

@davidpdrsn
Copy link

I am on version 0.9.0 and still getting these errors. This is the output of compile --verbose:

❯ bloop compile undoservice --verbose
[D] Loading workspace settings from bloop.settings.json
[D] Computing sources and classpath hashes for UndoUtils
[D] Computing sources and classpath hashes for undodb
[D] Computing sources and classpath hashes for awsSqs
[D] Computing sources and classpath hashes for zioSttp
[D] Computing sources and classpath hashes for Mailgun
[D] Computing sources and classpath hashes for apiclient
[D] Scheduling compilation for UndoUtils...
[D] Using successful result for UndoUtils associated with /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-nLCo3rs7Ro2gBkdlme1GrA==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-nLCo3rs7Ro2gBkdlme1GrA== to 2
[D] Scheduling compilation for Mailgun...
[D] Scheduling compilation for zioSttp...
[D] Scheduling compilation for undodb...
[D] Using successful result for zioSttp associated with /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-trtjnEE4QpaBuSpMI2CthA==
[D] Scheduling compilation for awsSqs...
[D] Scheduling compilation for apiclient...
[D] Using successful result for Mailgun associated with /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-CXU_7lwwQ9SPOKwgMkka_A==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-CXU_7lwwQ9SPOKwgMkka_A== to 2
[D] Using successful result for apiclient associated with /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==--WD5-DRFQLKTzYzXBhr5aQ==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==--WD5-DRFQLKTzYzXBhr5aQ== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Using successful result for awsSqs associated with /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hpWaVZzIS6ylD550YuB6sw==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-trtjnEE4QpaBuSpMI2CthA== to 2
[D] Using successful result for undodb associated with /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hs6lLjERTLWUQFGabqS_WA==
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hpWaVZzIS6ylD550YuB6sw== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-bsp-clients-classes/bloop-cli
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-nLCo3rs7Ro2gBkdlme1GrA==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hs6lLjERTLWUQFGabqS_WA== to 2
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-bsp-clients-classes/bloop-cli
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-internal-classes/bloop-cli-nsWIRBspT9W71YBUG0Ljtg==
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-bsp-clients-classes/bloop-cli
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-bsp-clients-classes/bloop-cli
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hpWaVZzIS6ylD550YuB6sw==
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==--WD5-DRFQLKTzYzXBhr5aQ==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-internal-classes/bloop-cli-WkO8lCyvSjqEac7kA4vSxQ==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-internal-classes/bloop-cli-FjIFyFE8Tpe2KK2xlBRT-Q==
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-bsp-clients-classes/bloop-cli
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-CXU_7lwwQ9SPOKwgMkka_A==
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-trtjnEE4QpaBuSpMI2CthA==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-internal-classes/bloop-cli--VU-ftdMTR2bUGaO7csbjg==
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-bsp-clients-classes/bloop-cli
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-internal-classes/bloop-cli-D-dLlqZBQ2ma8dHZtGb8Hg==
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hs6lLjERTLWUQFGabqS_WA==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-internal-classes/bloop-cli-WuuofR3ARwi4exRpjrHy6A==
[D] No changes
[D] Recording new last successful request for UndoUtils associated with /Users/david/dev/major/backend-scala/.bloop/UndoUtils/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-nLCo3rs7Ro2gBkdlme1GrA==
[D] Computing sources and classpath hashes for awsS3
[D] No changes
[D] Computing sources and classpath hashes for awsSns
[D] No changes
[D] No changes
[D] No changes
[D] No changes
[D] Recording new last successful request for apiclient associated with /Users/david/dev/major/backend-scala/.bloop/apiclient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==--WD5-DRFQLKTzYzXBhr5aQ==
[D] Computing sources and classpath hashes for CustomerIO
Deduplicating compilation of awsSns from cli client 'bloop-cli' (since 34.495s)
[D] Computing sources and classpath hashes for UndoGeoCoding
Deduplicating compilation of awsS3 from cli client 'bloop-cli' (since 34.495s)
[D] Recording new last successful request for Mailgun associated with /Users/david/dev/major/backend-scala/.bloop/Mailgun/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-CXU_7lwwQ9SPOKwgMkka_A==
[D] Computing sources and classpath hashes for undozio
[D] Computing sources and classpath hashes for awsS3
[D] Scheduling compilation for awsS3...
[D] Using successful result for awsS3 associated with /Users/david/dev/major/backend-scala/.bloop/awsS3/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-BQPtrK02Qcqfxr3X5PivWw==
[D] Computing sources and classpath hashes for awsSns
[D] Scheduling compilation for awsSns...
[D] Using successful result for awsSns associated with /Users/david/dev/major/backend-scala/.bloop/awsSns/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-b8Fx398tRo2iia_lX_baOw==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/awsSns/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-b8Fx398tRo2iia_lX_baOw== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/awsSns/bloop-bsp-clients-classes/bloop-cli
Deduplicating compilation of UndoGeoCoding from cli client 'bloop-cli' (since 34.498s)[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/awsSns/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-b8Fx398tRo2iia_lX_baOw==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/awsSns/bloop-internal-classes/bloop-cli-y3cqtSX6RGGJFfHJ_ZLV0g==
[D] No changes

[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/awsS3/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-BQPtrK02Qcqfxr3X5PivWw== to 2
Deduplicating compilation of CustomerIO from cli client 'bloop-cli' (since 34.499s)
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/awsS3/bloop-bsp-clients-classes/bloop-cli
[D] Computing sources and classpath hashes for CustomerIO
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/awsS3/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-BQPtrK02Qcqfxr3X5PivWw==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/awsS3/bloop-internal-classes/bloop-cli-8tEtUT9CR8q-3h-ZSxP1_Q==
[D] Computing sources and classpath hashes for UndoGeoCoding
[D] Scheduling compilation for UndoGeoCoding...
[D] Using successful result for UndoGeoCoding associated with /Users/david/dev/major/backend-scala/.bloop/UndoGeoCoding/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-I1jLlKW0Sv6GEEDmiVyyEg==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/UndoGeoCoding/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-I1jLlKW0Sv6GEEDmiVyyEg== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/UndoGeoCoding/bloop-bsp-clients-classes/bloop-cli
[D] No changes
[D] Scheduling compilation for CustomerIO...
[D] Using successful result for CustomerIO associated with /Users/david/dev/major/backend-scala/.bloop/CustomerIO/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-l25OaCjVSp6J579D3iLtkA==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/CustomerIO/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-l25OaCjVSp6J579D3iLtkA== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/UndoGeoCoding/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-I1jLlKW0Sv6GEEDmiVyyEg==
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/CustomerIO/bloop-bsp-clients-classes/bloop-cli
[D] Scheduling compilation for undozio...
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/CustomerIO/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-l25OaCjVSp6J579D3iLtkA==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/CustomerIO/bloop-internal-classes/bloop-cli-jKqEJ_hhTPyMXgKznNY8PQ==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/UndoGeoCoding/bloop-internal-classes/bloop-cli-BvtTow61StK725isxSZg9g==
[D] No changes
[D] Using successful result for undozio associated with /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-lnMrgSLwSuaooYmSFXduUw==
[D] No changes
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-lnMrgSLwSuaooYmSFXduUw== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-bsp-clients-classes/bloop-cli
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-lnMrgSLwSuaooYmSFXduUw==
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-internal-classes/bloop-cli-WT2z6DkvQ7CMMYcbQ27HPg==
[D] No changes
[D] Recording new last successful request for undozio associated with /Users/david/dev/major/backend-scala/.bloop/undozio/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-lnMrgSLwSuaooYmSFXduUw==
[D] Recording new last successful request for zioSttp associated with /Users/david/dev/major/backend-scala/.bloop/zioSttp/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-trtjnEE4QpaBuSpMI2CthA==
[D] Computing sources and classpath hashes for gatewayApiClient
[D] Computing sources and classpath hashes for branch
[D] Scheduling compilation for branch...
[D] Using successful result for branch associated with /Users/david/dev/major/backend-scala/.bloop/branch/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-MiGg_jguR-SbYynX2REi_A==
Deduplicating compilation of gatewayApiClient from cli client 'bloop-cli' (since 34.507s)
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/branch/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-MiGg_jguR-SbYynX2REi_A== to 2
[D] Computing sources and classpath hashes for gatewayApiClient
[D] Scheduling compilation for gatewayApiClient...
[D] Using successful result for gatewayApiClient associated with /Users/david/dev/major/backend-scala/.bloop/gatewayApiClient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-J8t__TUDTOC79CZvga9LNg==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/gatewayApiClient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-J8t__TUDTOC79CZvga9LNg== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/gatewayApiClient/bloop-bsp-clients-classes/bloop-cli
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/gatewayApiClient/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-J8t__TUDTOC79CZvga9LNg==
[D] External classes directory /Users/david/dev/major/backend-scala/.bloop/branch/bloop-bsp-clients-classes/bloop-cli
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/gatewayApiClient/bloop-internal-classes/bloop-cli-n3LZ2KsqQIGooNCgsaTAJQ==
[D] Read-only classes directory /Users/david/dev/major/backend-scala/.bloop/branch/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-MiGg_jguR-SbYynX2REi_A==
[D] No changes
[D] New rw classes directory /Users/david/dev/major/backend-scala/.bloop/branch/bloop-internal-classes/bloop-cli-qozNmLs0S8Ks38jUqVVcVw==
[D] No changes
[D] Recording new last successful request for awsSqs associated with /Users/david/dev/major/backend-scala/.bloop/awsSqs/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hpWaVZzIS6ylD550YuB6sw==
[D] Recording new last successful request for undodb associated with /Users/david/dev/major/backend-scala/.bloop/undodb/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-hs6lLjERTLWUQFGabqS_WA==
[D] Recording new last successful request for branch associated with /Users/david/dev/major/backend-scala/.bloop/branch/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-MiGg_jguR-SbYynX2REi_A==
[D] Computing sources and classpath hashes for shared
Deduplicating compilation of shared from cli client 'bloop-cli' (since 34.517s)
[D] Computing sources and classpath hashes for shared
[D] Scheduling compilation for shared...
[D] Using successful result for shared associated with /Users/david/dev/major/backend-scala/.bloop/shared/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-2676db-pRUOhE_OuUE4_tA==
[D] Increasing counter for /Users/david/dev/major/backend-scala/.bloop/shared/bloop-internal-classes/classes-Metals-0bYetVRkRGOw2tfOWYQY8Q==-2676db-pRUOhE_OuUE4_tA== to 2
[D] Disabled compiler plugin classloading, unsupported in 2.12.1
[D] Elapsed: 34.821734 ms
[E] /Users/david/dev/major/backend-scala/.bloop/shared/bloop-bsp-clients-classes/bloop-cli/dk/undo/cronductor/TestJob$.class
[T] java.nio.file.FileAlreadyExistsException: /Users/david/dev/major/backend-scala/.bloop/shared/bloop-bsp-clients-classes/bloop-cli/dk/undo/cronductor/TestJob$.class
[T]     sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
[T]     sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[T]     sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
[T]     sun.nio.fs.UnixCopyFile.copyFile(UnixCopyFile.java:243)
[T]     sun.nio.fs.UnixCopyFile.copy(UnixCopyFile.java:581)
[T]     sun.nio.fs.UnixFileSystemProvider.copy(UnixFileSystemProvider.java:253)
[T]     java.nio.file.Files.copy(Files.java:1274)
[T]     bloop.io.ParallelOps$.copy$1(ParallelOps.scala:167)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$7(ParallelOps.scala:200)
[T]     scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
[T]     monix.eval.internal.TaskRunLoop$.loop$2(TaskRunLoop.scala:321)
[T]     monix.eval.internal.TaskRunLoop$.startAsFuture(TaskRunLoop.scala:384)
[T]     monix.eval.Task.runAsync(Task.scala:117)
[T]     monix.eval.Task.runSyncMaybe(Task.scala:134)
[T]     monix.eval.Task.$anonfun$coeval$1(Task.scala:154)
[T]     monix.eval.Coeval$Always.apply(Coeval.scala:666)
[T]     monix.eval.Coeval.value(Coeval.scala:76)
[T]     bloop.io.ParallelOps$.$anonfun$copyDirectories$6(ParallelOps.scala:226)
[T]     monix.reactive.internal.consumers.ForeachAsyncConsumer$$anon$1.onNext(ForeachAsyncConsumer.scala:41)
[T]     monix.reactive.internal.consumers.LoadBalanceConsumer$$anon$2.$anonfun$signalNext$1(LoadBalanceConsumer.scala:219)
[T]     java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[T]     java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[T]     java.lang.Thread.run(Thread.java:748)

Just let me know if this is a separate issue from what OP is seeing and if I should make a new issue.

@tgodzik
Copy link
Contributor

tgodzik commented May 15, 2020

@davidpdrsn Looks like a separate issue, would you mind reporting it in scalacenter/bloop ?

@davidpdrsn
Copy link

Yes will do 👍

@tgodzik
Copy link
Contributor

tgodzik commented May 29, 2020

Looks like issue was fixed in Bloop. Haven't encountered it since the last release, but feel free to report if anything like this happens again.

@tgodzik tgodzik closed this as completed May 29, 2020
@jdegoes
Copy link
Author

jdegoes commented Jan 31, 2023

This issue is most definitely not resolved, and in any of the code bases that I work on regularly (including ZIO), it has never been resolved (though frequency sometimes changes with Metals releases), and I have observed the same issue while pairing with > 10 developes during regular mentoring sessions across a variety of projects, each with its own build.

To my knowledge, there are no finite and repeatable set of steps that can place Metals into this state, other than, "Use Metals with a project like ZIO for some minutes to some hours". However, it will always end up in this state and the steps needed to momentarily reverse it can become quite drastic.

@tgodzik
Copy link
Contributor

tgodzik commented Jan 31, 2023

I closed the issues since there didn't seem to be any of those logs about Deduplication happening, no one reported more of them since 2 years and that seemed to be a culprit here. Of course, there might be some other issues to take a look into.

I have observed the same issue while pairing with > 10 developes during regular mentoring sessions across a variety of projects, each with its own build.

You mentioned multiple issues in your original report regarding compilation that wasn't stopping. Is that error the same one you're continually seeing? Could you be more specific on the exact errors you're experiencing? You mention > 10 other developers, were you all on the same OS? Were you all using Bloop as your build server? Did you experience the same with sbt? The more information you can provide, the easier it is for us to look into.

Would be cool to run bloop compile --verbose in such a case (if Bloop is used) to see if we can get more data from there.

We are also working on some more reporting mechanisms so that it's easier to catch some transient errors, if you have any ideas for scenarios where things might break (any logs etc. we can add some reporting around there).

@jdegoes
Copy link
Author

jdegoes commented Feb 2, 2023

Sometimes I do not see any errors in the log. Metals is frozen and nothing appears to function (including restarting the server); and often any compiler errors appear frozen in VS Code.

I regularly pair with dozens of Scala developers, a good number of which run into this issue in different circumstances (different code bases): I'd say 90% of them are on Mac. I encounter more problems on Windows than Mac, but it's difficult to say where in the chain those issues lie (for example, opening the ZIO project on a Windows machine has often resulted in thousands of errors appearing everywhere, even though the code compiles fine with SBT).

It would help me and other developers to submit bug reports if there is a set of well-defined artifacts that we can give you that can help you get closer to understanding what's going on.

For example:

  • Complete logs, ideally scrubbed to remove PII
  • JVM thread dump (because some 'hanging' could have a concurrent origin)
  • JMX metrics or anything that could be useful to detect unusual circumstances (high memory usage, high thread count, etc.)

It would be wonderful if Metals had an action along the lines of Generate Bug Report which could collect all relevant details in a ZIP file for submission as a new issue. Is that a feature you would consider for inclusion if developed or sponsored independently?

Non-deterministic 'hangs' cannot be reproduced deterministically in a finite series of steps; they often occur after working for 10 minutes or 3 hours; tying the defects to this action or that action or doing any sort of minimization is not feasible.

@matthughes
Copy link

I will add that I've had a lot of these experiences as well though I'd add that anecdotally it's gotten much better over the past year.

I would love a "Generate Bug Report". I've spent a lot of time trying to dig through lsp/bsp traces, jstack traces to see what might be going on when it's gotten in that state with not much luck. Sadly my resolution is having a killmetals alias and just accepting that I need to kill metals/bloop blow away .bloop/.metals folders and while I've come to accept it, it's not a great selling point to folks joining Scala. Many of the folks who have joined my team have just accepted that autocomplete "doesn't work" and don't even try to get the IDE back into a working state and essentially use Metals as a glorified syntax highlighter. When Metals works -- which is often -- it's a gamechanging experience. I would have paid a lot of money for something that worked this well when I started in Scala almost 10 years ago.

I think realistically we need something like cats-effect Fiber Dump (https://typelevel.org/cats-effect/docs/core/fiber-dumps) where you can send a signal to the metals process to dump as much information about it's internal state as possible. Can it talk to the BSP? Is it awaiting a response from something, etc. I don't know enough about the internals to enumerate all the data. Obviously if that can be exposed to Metals Doctor even better but for now, crowd-sourcing these reports would certainly help pinpoint where the problems lie. Is it Metals? Is it Bloop? Is it SBT BSP? I almost never use SBT FWIW.

@sideeffffect
Copy link

@jdegoes @matthughes When you have these issues, does Metals use sbt or Bloop as the Build Server? Have you tried switching from one to the other? Has that changed the behavior with regards to reliability etc.?

@jdegoes
Copy link
Author

jdegoes commented Feb 3, 2023

I only use Bloop as the build server (as do most developers that I know). I will give SBT a try to see there is any change.

@tgodzik
Copy link
Contributor

tgodzik commented Feb 3, 2023

I only use Bloop as the build server (as do most developers that I know). I will give SBT a try to see there is any change.

Bloop is great for compiling multiple projects at the same time, but is getting less maintenance than sbt itself. We are trying to up out game on that front, but it's always good to try out sbt as the alternative. You can Metals + sbtn to have the best experience. We are thinking of Maybe switching to sbt as the default if it proves more reliable.

Alternatively, for Bloop there should be two steps to fix things:

  • clean compile (removes all compiled files, run compilation again)
  • restart build server (all server state is cleared)

Removing things (.bloop/.metals) most likely will not help and if both these will not work it means it's something reproducible in that state and we can try running bloop compile --verbose, which should produce some kind of an exception.

So in reality when using Bloop there can be 4 layers of problems:

  • metals issues (usually quickest to fix)
  • incremental compilation issues (clean compiler should fix that)
  • issues with Bloop caching wrong internal state (restart should help)
  • wrong configuration files generated for Bloop (this might require reimport/removing things in .bloop )

It would be wonderful if Metals had an action along the lines of Generate Bug Report which could collect all relevant details in a ZIP file for submission as a new issue. Is that a feature you would consider for inclusion if developed or sponsored independently?

We are looking into that in #4924 so please add any ideas on what to include. This should help out figuring out the problems of users with any transient issues and reduce the need for restart/clean-compile.

@jdegoes
Copy link
Author

jdegoes commented Feb 4, 2023

I will report back when I have had a chance to thoroughly test it. In the meantime, I received reports from two people claiming (separately) that:

  1. If the computer goes to sleep, when it wakes up again, Metals breaks
  2. If a Git branch is switched, then Metals breaks

These do not explain most situations but perhaps they can be helpful to isolating a problem in one of the 4 layers (2 sounds like Bloop).

@jdegoes
Copy link
Author

jdegoes commented Feb 4, 2023

Another report:

These days I run sbt bloopInstall after deleting .bloop and .metals, manually from terminal before opening up in VS. It works for as long as I am coding. But stops working next day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable
Projects
None yet
Development

No branches or pull requests

7 participants