Skip to content

clients receive completed: true twice when compiling with the grpc interface #2711

Closed
@dankeboy36

Description

@dankeboy36

Describe the problem

The CLI reports completed: true twice when compiling via the grpc API

{
  "progress": {
    "percent": 92.592606
  }
}
{
  "progress": {
    "percent": 96.29631
  }
}
{
  "progress": {
    "completed": true,
    "percent": 100.000015
  }
}
{
  "progress": {
    "completed": true,
    "percent": 103.70372
  }
}

To reproduce

Open a terminal:

./arduino-cli daemon
Daemon is now listening on 127.0.0.1:50051
{"IP":"127.0.0.1","Port":"50051"}

In another terminal:

tree my_sketch             
my_sketch
└── my_sketch.ino

1 directory, 1 file
cat my_sketch/my_sketch.ino
void setup() {}
void loop() {}
grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Create
{
  "instance": {
    "id": 1
  }
}
grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Init
grpcurl \
  -plaintext \
  -import-path ./rpc \
  -proto cc/arduino/cli/commands/v1/commands.proto \
  -d '{"instance": {"id": 1}, "fqbn": "arduino:avr:diecimila", "sketchPath": "./my_sketch/my_sketch.ino"}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Compile
{
  "progress": {
    "percent": 3.7037036
  }
}
{
  "progress": {
    "percent": 7.4074073
  }
}
{
  "progress": {
    "percent": 11.111111
  }
}
{
  "progress": {
    "percent": 14.814815
  }
}
{
  "progress": {
    "percent": 18.518518
  }
}
{
  "progress": {
    "percent": 22.222221
  }
}
{
  "progress": {
    "percent": 25.925924
  }
}
{
  "progress": {
    "percent": 29.629627
  }
}
{
  "progress": {
    "percent": 29.629627
  }
}
{
  "progress": {
    "percent": 33.333332
  }
}
{
  "progress": {
    "percent": 37.037037
  }
}
{
  "progress": {
    "percent": 40.74074
  }
}
{
  "progress": {
    "percent": 44.444447
  }
}
{
  "progress": {
    "percent": 48.14815
  }
}
{
  "progress": {
    "percent": 51.851856
  }
}
{
  "progress": {
    "percent": 55.55556
  }
}
{
  "progress": {
    "percent": 59.259266
  }
}
{
  "progress": {
    "percent": 62.96297
  }
}
{
  "progress": {
    "percent": 66.66667
  }
}
{
  "progress": {
    "percent": 70.37038
  }
}
{
  "progress": {
    "percent": 74.07408
  }
}
{
  "progress": {
    "percent": 77.77779
  }
}
{
  "progress": {
    "percent": 81.48149
  }
}
{
  "progress": {
    "percent": 85.185196
  }
}
{
  "progress": {
    "percent": 88.8889
  }
}
{
  "progress": {
    "percent": 92.592606
  }
}
{
  "progress": {
    "percent": 96.29631
  }
}
{
  "progress": {
    "completed": true,
    "percent": 100.000015
  }
}
{
  "progress": {
    "completed": true,
    "percent": 103.70372
  }
}
{
  "outStream": "U2tldGNoIHVzZXMgNDQ0IGJ5dGVzICgxJSkgb2YgcHJvZ3JhbSBzdG9yYWdlIHNwYWNlLiBNYXhpbXVtIGlzIDMwNzIwIGJ5dGVzLgpHbG9iYWwgdmFyaWFibGVzIHVzZSA5IGJ5dGVzICgwJSkgb2YgZHluYW1pYyBtZW1vcnksIGxlYXZpbmcgMjAzOSBieXRlcyBmb3IgbG9jYWwgdmFyaWFibGVzLiBNYXhpbXVtIGlzIDIwNDggYnl0ZXMuCg=="
}
{
  "result": {
    // removed
  }
}

Expected behavior

Clients receive completed: true once. When completed: true, then percent is 100.

Arduino CLI version

arduino-cli Version: git-snapshot Commit: 863c1ec Date: 2024-09-28T07:43:10Z

Operating system

macOS

Operating system version

11.7.10

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

conclusion: resolvedIssue was resolvedtopic: codeRelated to content of the project itselftopic: gRPCRelated to the gRPC interfacetype: imperfectionPerceived defect in any part of project

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions