Description
Describe the problem
The compilation operation never returns under the following conditions:
- It is triggered by the gRPC interface
- The sketch produces a large quantity of output on the standard error stream (
errStream
field of thecc.arduino.cli.commands.v1.ArduinoCoreService.Compile
response)
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
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