Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cc.arduino.cli.commands.v1.ArduinoCoreService.Init hangs if Monitor is running #2719

Closed
3 tasks done
per1234 opened this issue Oct 6, 2024 · 1 comment · Fixed by #2728
Closed
3 tasks done

cc.arduino.cli.commands.v1.ArduinoCoreService.Init hangs if Monitor is running #2719

per1234 opened this issue Oct 6, 2024 · 1 comment · Fixed by #2728
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Oct 6, 2024

Describe the problem

A client might make additional cc.arduino.cli.commands.v1.ArduinoCoreService.Init requests.

For example, Arduino IDE periodically (and on demand) performs the following sequence:

  1. Update package and/or library index
  2. Initialize gRPC client instance

Arduino IDE also makes an Init request after installing/updating a platform or library.

🐛 If there is a running cc.arduino.cli.commands.v1.ArduinoCoreService.Monitor process, the Init request hangs.

To reproduce

Equipment

  • Any board or other device that will produce a serial port on your computer.

Demo

  1. Open a terminal.
  2. Start the Arduino CLI gRPC daemon:
    $ arduino-cli version
    
    arduino-cli  Version: git-snapshot Commit: 863c1ec36 Date: 2024-10-06T06:54:36Z
    
    $ arduino-cli daemon
    
    Daemon is now listening on 127.0.0.1:50051
    {"IP":"127.0.0.1","Port":"50051"}
    
  3. Open another terminal.
  4. Run the following grpcurl command in the new terminal to create a gRPC client instance:
    $ 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
      }
    }
    
  5. Run the following command to initialize the instance:
    $ 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
    
  6. Run the following command to start a Monitor request:
    $ grpcurl \
      -plaintext \
      -import-path ./rpc \
      -proto cc/arduino/cli/commands/v1/commands.proto \
      -d @ \
      127.0.0.1:50051 \
      cc.arduino.cli.commands.v1.ArduinoCoreService.Monitor
    
  7. Send the request data to open the available serial port:
    ❗ Adjust the value of open_request.port.address as is appropriate for the port on your computer.
    {
      "open_request": {
        "instance": { "id": 1 },
        "port": { "address": "COM42", "protocol": "serial" }
      }
    }
  8. Open another terminal.
  9. Run the following command in the new terminal to reinitialize the gRPC client instance:
    $ 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
    

🐛 The reinitialization hangs.

Expected behavior

cc.arduino.cli.commands.v1.ArduinoCoreService.Init does not hang under any conditions.

Arduino CLI version

863c1ec

Operating system

  • Linux
  • macOS
  • Windows

Operating system version

  • Ubuntu 24.04
  • macOS Sonoma
  • Windows 11

Additional context

I bisected the regression to bb815cf / #2565 (the fault does not occur when using the build from the previous commit 917dcc5).


Originally reported at #2347 (comment) (note the original issue report #2347 was from long before the time of the regression, so is different from the Monitor-specific issue tracked here even if the symptoms are somewhat similar).

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
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project topic: gRPC Related to the gRPC interface labels Oct 6, 2024
@frankcohen

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: gRPC Related to the gRPC interface type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants