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

There is no communication of problem when monitor process creation fails #1508

Closed
3 tasks done
per1234 opened this issue Sep 30, 2022 · 0 comments · Fixed by #1965
Closed
3 tasks done

There is no communication of problem when monitor process creation fails #1508

per1234 opened this issue Sep 30, 2022 · 0 comments · Fixed by #1965
Assignees
Labels
conclusion: resolved Issue was resolved topic: code Related to content of the project itself topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Sep 30, 2022

Describe the problem

When the Arduino IDE Serial Monitor is opened, a pluggable monitor tool process is started. This process may error if the port can't be opened. Inability to open a port is a common problem for Arduino users, usually caused by already having it open in another application, not having set up system permissions for access, or the port being stuck in a glitched state.

The Arduino IDE Serial Monitor does not communicate in any way to the user that there is a problem, nor what the nature of that problem might be when starting monitor process fails after Serial Monitor is opened.

🐛 The user will not understand why the expected output is not being sent or received from Serial Monitor. They, and those supporting them, may waste quite some time studying their code and hardware for problems.

To reproduce

Equipment

  • Any Arduino board that produces a serial port.

Steps

  1. Upload a sketch to your Arduino board that uses serial input and output:
    unsigned long previousMillis;
    
    void setup() {
      Serial.begin(9600);
    }
    
    void loop() {
      if (Serial.available() > 0) {
        while (Serial.available() > 0) {
          Serial.write(Serial.read());
          delay(10);
        }
      } else if (millis() - previousMillis >= 1000) {
        previousMillis = millis();
        Serial.println("hello");
      }
    }
  2. Close the Arduino IDE 2.x Serial Monitor view if it is open.
  3. Open the serial port of the Arduino board in any other application.
    e.g., Arduino IDE 1.x Serial Monitor, arduino-cli monitor
  4. Select the port of the Arduino board in the Arduino IDE 2.x Tools > Port menu.
  5. Select Tools > Serial Monitor from the Arduino IDE 2.x menus to open the Serial Monitor view.

🐛 There is no indication of any problem other than the lack of a baud rate menu:

image

🐛 The expected "hello" output is not printed.
🐛 Any data sent via the "Message" field is not received by the board.

Expected behavior

Clear communication of the problem when starting a monitor process fails.

Arduino IDE version

2.0.1-snapshot-6f07717

Operating system

Windows

Operating system version

10

Additional context

The logs show the Arduino CLI daemon is communicating the problem to the IDE:

daemon INFO {"level":"info","monitor":"serial-monitor","msg":"Starting monitor process","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"level":"info","monitor":"serial-monitor","msg":"Monitor process started successfully!","time":"2022-09-30T04:07:41-07:00"}
{"command":"HELLO 1 \"arduino-cli 0.27.1\"","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"error":false,"event_type":"hello","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"command":"DESCRIBE","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}
{"error":false,"event_type":"describe","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"CONFIGURE dtr on","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"CONFIGURE parity none","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}
{"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"CONFIGURE rts on","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"CONFIGURE stop_bits 1","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}
{"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"command":"CONFIGURE baudrate 9600","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}
{"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"CONFIGURE bits 8","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"error":false,"event_type":"configure","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"command":"OPEN 127.0.0.1:17515 COM7","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"error":true,"event_type":"open","level":"info","message":"Serial port busy","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}
{"command":"QUIT","level":"info","monitor":"serial-monitor","msg":"sending command","time":"2022-09-30T04:07:41-07:00"}
{"error":false,"event_type":"quit","level":"info","message":"OK","monitor":"serial-monitor","msg":"received message","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"level":"info","monitor":"serial-monitor","msg":"Killing monitor process","time":"2022-09-30T04:07:41-07:00"}
{"error":"TerminateProcess: Access is denied.","level":"error","monitor":"serial-monitor","msg":"Sent kill signal","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"level":"error","monitor":"serial-monitor","msg":"stopped decode loop: EOF","time":"2022-09-30T04:07:41-07:00"}

daemon INFO {"level":"info","monitor":"serial-monitor","msg":"Monitor process killed","time":"2022-09-30T04:07:41-07:00"}

monitor-service ERROR Error: 2 UNKNOWN: Port monitor error: command 'open' failed: Serial port busy
    at Object.callErrorFromStatus (C:\ide 2\tip\135-6f07717\resources\app\node_modules\@grpc\grpc-js\build\src\call.js:31:26)
    at Object.onReceiveStatus (C:\ide 2\tip\135-6f07717\resources\app\node_modules\@grpc\grpc-js\build\src\client.js:409:49)
    at Object.onReceiveStatus (C:\ide 2\tip\135-6f07717\resources\app\node_modules\@grpc\grpc-js\build\src\client-interceptors.js:328:181)
    at C:\ide 2\tip\135-6f07717\resources\app\node_modules\@grpc\grpc-js\build\src\call-stream.js:187:78
    at processTicksAndRejections (node:internal/process/task_queues:78:11)
monitor-service INFO monitor to COM7 using serial closed by server

Prior to #982, there was a (misleading) indication of a problem under these conditions:

image


Arduino IDE 1.x clearly communicates the problem to the user:

image


Arduino CLI clearly communicates the problem to the command line interface user:

$ arduino-cli monitor --port COM7
Port monitor error: command 'open' failed: Serial port busy

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest 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: serial monitor Related to the Serial Monitor labels Sep 30, 2022
@kittaakos kittaakos self-assigned this Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 17, 2023
kittaakos pushed a commit that referenced this issue Mar 29, 2023
kittaakos pushed a commit that referenced this issue Mar 30, 2023
 - Handle when the board's platform is not installed (Closes #1974)
 - UX: Smoother monitor widget reset (Closes #1985)
 - Fixed monitor <input> readOnly state (Closes #1984)
 - Set monitor widget header color (Ref #682)

Closes #1508

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Mar 30, 2023
 - Handle when the board's platform is not installed (Closes #1974)
 - UX: Smoother monitor widget reset (Closes #1985)
 - Fixed monitor <input> readOnly state (Closes #1984)
 - Set monitor widget header color (Ref #682)

Closes #1508

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Mar 31, 2023
 - Handle when the board's platform is not installed (Closes #1974)
 - UX: Smoother monitor widget reset (Closes #1985)
 - Fixed monitor <input> readOnly state (Closes #1984)
 - Set monitor widget header color (Ref #682)

Closes #1508

Signed-off-by: Akos Kitta <[email protected]>
kittaakos pushed a commit that referenced this issue Apr 13, 2023
 - Handle when the board's platform is not installed (Closes #1974)
 - UX: Smoother monitor widget reset (Closes #1985)
 - Fixed monitor <input> readOnly state (Closes #1984)
 - Set monitor widget header color (Ref #682)

Closes #1508

Signed-off-by: Akos Kitta <[email protected]>
@kittaakos kittaakos added the conclusion: resolved Issue was resolved label Apr 13, 2023
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: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants