digital-asset / daml

The Daml smart contract language
https://www.digitalasset.com/developers
797 stars 199 forks source link

The IDE crashes on some projects #17680

Open paulbrauner-da opened 10 months ago

paulbrauner-da commented 10 months ago

Affected Daml version

Bug description

Often when not always, when opening a .daml file in daml studio, the code lenses don't appear and the debug output shows:

2023-10-25 10:03:21.35 [INFO] [LanguageServer]
SDK version: 2.8.0-snapshot.20231023.12243.0.v14f9f58d
2023-10-25 10:03:21.36 [INFO] [LanguageServer]
Registering ide configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri 4949871890106276921 "file:///tmp/quickstart"]}

2023-10-25 10:03:21.36 [INFO] [LanguageServer]
Opened text document: file:///tmp/quickstart/daml/Main.daml

2023-10-25 10:03:21.75 [ERROR] [LanguageServer]
Unexpected exception on request, please report!
Exception: Error when running Shake build system:
at action, called at compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs:1161:5 in compilerZSdamlcZSdaml-ide-coreZSdaml-ide-core:Development.IDE.Core.Rules.Daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: OfInterest;
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackage; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackageDeps; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateDalf; /tmp/quickstart/daml/Iou.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateRawDalf; /tmp/quickstart/daml/Iou.daml
* Raised the exception:
thread killed

[Error - 12:03:21 PM] Request textDocument/codeLens failed.
Message: Error when running Shake build system:
at action, called at compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs:1161:5 in compilerZSdamlcZSdaml-ide-coreZSdaml-ide-core:Development.IDE.Core.Rules.Daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: OfInterest;
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackage; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackageDeps; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateDalf; /tmp/quickstart/daml/Iou.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateRawDalf; /tmp/quickstart/daml/Iou.daml
* Raised the exception:
thread killed

Code: -32603

2023-10-25 10:03:26.73 [INFO] [LanguageServer]
Hover request at position 18:19 in file: /tmp/quickstart/daml/Main.daml

2023-10-25 10:03:26.77 [ERROR] [LanguageServer]
Unexpected exception on request, please report!
Exception: Error when running Shake build system:
at action, called at compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs:1161:5 in compilerZSdamlcZSdaml-ide-coreZSdaml-ide-core:Development.IDE.Core.Rules.Daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: OfInterest;
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackage; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackageDeps; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateDalf; /tmp/quickstart/daml/Iou.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateRawDalf; /tmp/quickstart/daml/Iou.daml
* Raised the exception:
thread killed

[Error - 12:03:26 PM] Request textDocument/hover failed.
Message: Error when running Shake build system:
at action, called at compiler/damlc/daml-ide-core/src/Development/IDE/Core/Rules/Daml.hs:1161:5 in compilerZSdamlcZSdaml-ide-coreZSdaml-ide-core:Development.IDE.Core.Rules.Daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: OfInterest;
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackage; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GeneratePackageDeps; /tmp/quickstart/daml/Main.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateDalf; /tmp/quickstart/daml/Iou.daml
at apply, called at src/Development/IDE/Core/Shake.hs:563:63 in ghcide-0.1.0:Development.IDE.Core.Shake
* Depends on: GenerateRawDalf; /tmp/quickstart/daml/Iou.daml
* Raised the exception:
thread killed

Code: -32603

To reproduce

daml-skd-head
cd /tmp
daml-head new quickstart --template quickstart-java
cd quickstart
daml-head studio .
paulbrauner-da commented 10 months ago

We've narrowed it down to https://github.com/digital-asset/daml/commit/fd7a5463ce3adb6ae0a95e7187fa0c6323e9864e but we don't know which part yet.

paulbrauner-da commented 10 months ago

Actually, I got it to crash at 8bce3fc1ca589478ee564212f50869cf3b98be83 as well

paulbrauner-da commented 10 months ago

https://github.com/digital-asset/daml/pull/17696 (reverting the entire cleanup PR) seems to fix the problem, albeit in an unsatisfactory way