Skip to content

cc.arduino.cli.commands.v1.ArduinoCoreService.Compile gRPC method call hangs when there is a large quantity of stderr output #2169

Closed
@per1234

Description

@per1234

Describe the problem

The compilation operation never returns under the following conditions:

To reproduce

Setup

$ arduino-cli version

arduino-cli.exe  Version: git-snapshot Commit: 2a5c83a8 Date: 2023-05-04T04:31:10Z

$ mkdir /tmp/ManyWarningsSketch

$ i=0; while [ "$i" -lt 2500 ]; do i=$(( i + 1 )); echo "#warning foo" >> /tmp/ManyWarningsSketch/ManyWarningsSketch.ino; done  # Make code produce a large quantity of stderr compilation output

$ printf "void setup() {}\nvoid loop() {}\n" >> "/tmp/ManyWarningsSketch/ManyWarningsSketch.ino"

$ arduino-cli daemon

Daemon is now listening on 127.0.0.1:50051

Demo

run the following grpcurl commands in another terminal:

$ 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:uno", "sketch_path": "/tmp/ManyWarningsSketch", "warnings": "all"}' \
  127.0.0.1:50051 \
  cc.arduino.cli.commands.v1.ArduinoCoreService.Compile

[...]

{
  "progress": {
    "percent": 100
  }
}
{
  "outStream": "U2tldGNoIHVzZXMgNDQ0IGJ5dGVzICgxJSkgb2YgcHJvZ3JhbSBzdG9yYWdlIHNwYWNlLiBNYXhpbXVtIGlzIDMyMjU2IGJ5dGVzLgpHbG9iYWwgdmFyaWFibGVzIHVzZSA5IGJ5dGVzICgwJSkgb2YgZHluYW1pYyBtZW1vcnksIGxlYXZpbmcgMjAzOSBieXRlcyBmb3IgbG9jYWwgdmFyaWFibGVzLiBNYXhpbXVtIGlzIDIwNDggYnl0ZXMuCg=="
}

🐛 The command never returns.

Expected behavior

cc.arduino.cli.commands.v1.ArduinoCoreService.Compile method call always returns.

Arduino CLI version

2a5c83a

Operating system

Windows

Operating system version

11

Additional context

I bisected the regression to eece582


I'm not able to reproduce the fault when I add the --debug flag to the arduino-cli daemon invocation.


I can also reproduce the fault using Arduino IDE, so it is not specific to grpcurl.

I am not able to reproduce the fault using the Arduino CLI command line interface (with either text output or json output).

I am not able to reproduce the fault when compiling sketches the produce a large quantity of stdout compilation output.


Originally reported by @KurtE at https://forum.arduino.cc/t/build-with-lots-of-errors-hangs-arduino-process/1116008

Additional reports

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

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions