digital-asset / daml

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

Daml language server crashes on non-existent data dependency #17349

Open meiersi-da opened 1 year ago

meiersi-da commented 1 year ago

Affected Daml version

2.7.0

Bug description

When starting daml studio with the following daml.yaml contents

sdk-version: 2.7.0
name: daml-app-template
source: app/daml/src/test/daml
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
  - daml-trigger
data-dependencies:
  - .lib/daml-finance/Daml.Finance.Account/2.0.0/daml-finance-account-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Holding/2.0.0/daml-finance-holding-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Interface.Account/2.0.0/daml-finance-interface-account-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Interface.Holding/2.0.0/daml-finance-interface-holding-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Interface.Settlement/2.0.0/daml-finance-interface-settlement-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Interface.Types.Common/1.0.1/daml-finance-interface-types-common-1.0.1.dar
  - .lib/daml-finance/Daml.Finance.Interface.Util/2.0.0/daml-finance-interface-util-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Settlement/2.0.0/daml-finance-settlement-2.0.0.dar
  - .lib/daml-finance/Daml.Finance.Util/3.0.0/daml-finance-util-3.0.0.dar
build-options:
  - --include=app/daml/src/main/daml
  - --ghc-option=-Wunused-binds
  - --ghc-option=-Wunused-matches
start-navigator: no
codegen:
  java:
    package-prefix: com.daml.app.template.codegen
    output-directory: app/backend/build/generated/daml-codegen-java

in a setup where the .lib directory does not exist and opening a .daml file the language server crashes with

damlc: .lib/daml-finance/Daml.Finance.Account/2.0.0/daml-finance-account-2.0.0.dar: openBinaryFile: does not exist (No such file or directory)
[Info  - 7:51:06 AM] Connection to server got closed. Server will restart.

To reproduce

  1. Clone https://github.com/DACH-NY/daml-app-template
  2. Open /home/simon/daml-app-template/app/daml/src/main/daml/Daml/Finance/Network/App/Registry/Install.daml
  3. Observe the language server crashing with the above error.

Expected behavior

The language server should not crash, but report an error on daml.yaml that there is a data dependency missing. Ideally on the line where the data dependency is declared.

Additional context

OS: Ubuntu

dylant-da commented 1 year ago

Thanks Simon - a lot of the team is out for the next weeks, but we'll take a look at fixing this promptly.

meiersi-da commented 1 year ago

This seems low severity to me, as this error goes away after making sure that the data dependencies are present and Daml studio is restarted. Final call is obviously with the team maintaining Daml studio.