Skip to content

bug: deduplicate for cancelled compilations #2170

Open
@kasiaMarek

Description

@kasiaMarek

Bloop deduplication mechanism seems not take into account a possibility of cancellation.
In a scenario:

  • compile request (1)
  • compile request (2)
  • cancel compile request (1)

compilation requests get deduplicated and the sources aren't fully compiled as result.

Extra context:

In basic test in CancelCompileLspSuite in metals the are three build targets "a", "b", and "c". Two compilation requests are send but the first one is cancelled. Only "a" build target is compiled. Ci trace:

2023.10.02 12:07:45 INFO  time: generated quick build in 85ms
[2693](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2694)
2023.10.02 12:07:45 INFO  logging to files /home/runner/work/metals/metals/tests/unit/target/e2e/compile-cancel/basic/.metals/metals.log
[2694](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2695)
2023.10.02 12:07:45 INFO  Started: Metals version 0.0.0+1-12b1b47a+20231002-1201-SNAPSHOT in folders '/home/runner/work/metals/metals/tests/unit/target/e2e/compile-cancel/basic' .
[2695](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2696)
2023.10.02 12:07:45 INFO  Attempting to connect to the build server...
[2696](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2697)
2023.10.02 12:07:45 INFO  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /home/runner/work/metals/metals/tests/unit/target/e2e/compile-cancel/basic/.metals/bsp.trace.json or /home/runner/.cache/metals/bsp.trace.json
[2697](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2698)
2023.10.02 12:07:45 INFO  time: Connected to build server in 82ms
[2698](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2699)
2023.10.02 12:07:45 INFO  Connected to Build server: Bloop v1.5.11
[2699](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2700)
2023.10.02 12:07:45 INFO  time: indexed workspace in 0.47s
[2700](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2701)
2023.10.02 12:07:45 INFO  compiling a (1 scala source)
[2701](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2702)
2023.10.02 12:07:46 INFO  tests.TestingServer#executeCommand 
[2702](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2703)
2023.10.02 12:07:46 INFO  Executing command [compile-cancel]
[2703](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2704)
2023.10.02 12:07:46 INFO  compilation cancelled
[2704](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2705)
2023.10.02 12:07:46 INFO  Cancelling compilation on Bloop server
[2705](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2706)
2023.10.02 12:07:46 INFO  Deduplicating compilation of a from bsp client 'Metals 0.0.0+1-12b1b47a+20231002-1201-SNAPSHOT' (since 1.54s)
[2706](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2707)
2023.10.02 12:07:46 INFO  compiling a (1 scala source)
[2707](https://github.com/scalameta/metals/actions/runs/6379271620/job/17311437263?pr=5683#step:4:2708)
2023.10.02 12:07:46 INFO  time: compiled a in 0.59s

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA defect or misbehaviour.difficulty / hardAny change that is hard to implement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions