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

Upload fails if port is open in Serial Monitor of another window #586

Closed
per1234 opened this issue Oct 31, 2021 · 3 comments · Fixed by #982
Closed

Upload fails if port is open in Serial Monitor of another window #586

per1234 opened this issue Oct 31, 2021 · 3 comments · Fixed by #982
Assignees
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: code Related to content of the project itself topic: documentation Related to documentation for the project topic: serial monitor Related to the Serial Monitor type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Oct 31, 2021

Describe the bug

It is not uncommon for a user to have multiple windows open with the same port selected in each. If the Serial Monitor is open in one of those windows, uploads from the other window will fail.

To Reproduce

  1. Connect any Arduino board to your computer.
  2. Select the board and port in the Arduino IDE menus.
  3. Open Serial Monitor (e.g., Tools > Serial Monitor).
  4. Select File > New from the Arduino IDE menus.
  5. Select Sketch > Upload from the Arduino IDE menus.
    🙁 Note that the upload has failed with an error something like "avrdude: ser_open(): can't open device "\\.\COM7": Access is denied."

Expected behavior

Handle sharing port usage between windows automagically.

OR

More effectively communicate the cause of the upload failure and the required action to the user.

OR

Clearly document the cause of the upload failure and the required action (#271).

I would recommend taking the approach of "so you have x problem, here is the solution ..." rather than "here is how to upload/use Serial Monitor properly ...". The reason is that the user is much more likely to go searching for a specific solution once they have the problem than to proactively study the documentation in advance of doing an upload.

With this approach, the appropriate location for the documentation would be the Help Center. The classic Arduino IDE points the user there in the event of a failed upload.

The article should be titled with the unique components of the various common error messages that occur when attempting to upload to an open port. It should also take into account that there are multiple possible causes of this error.

Desktop

  • OS: Windows 10
  • Version: 2.0.0-beta.12-nightly.20211028
    Date: 2021-10-28T03:03:25.353Z
    CLI Version: 0.19.1 alpha [718bbbf2]

Additional context

Originally reported at #271 (comment)

Comparison to classic Arduino IDE

This is not usually a problem in the classic Arduino IDE because all windows share the same Serial Monitor and are able to juggle the control of the port between the upload process and Serial Monitor automagically.

The exception is when the user has opened multiple instances of the Arduino IDE, in which case it behaves the same as Arduino IDE 2.x in that each instance has its own Serial Monitor and can not control the Serial Monitor of the other instance. However, this multiple instance usage is not very common, and more often employed by advanced users who are easily able to identify the cause of the upload failure that results from these conditions.

@per1234 per1234 added topic: documentation Related to documentation for the project 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 Oct 31, 2021
@per1234 per1234 changed the title Upload fails if port is open in Serial Monitor of another window Port selection from other window is used by Serial Monitor Oct 31, 2021
@per1234 per1234 changed the title Port selection from other window is used by Serial Monitor Upload fails if port is open in Serial Monitor of another window Oct 31, 2021
@ubidefeo
Copy link

ubidefeo commented Nov 1, 2021

hey @per1234
I am able to reproduce this, let's bring it into the backlog.
I believe the handling of Serial ports should be done automagically.
If a port is open and an upload towards the same port is initiated, the connection should be severed and upload started.
I also think the previous connection should not be automatically re-opened.

u.

@rsora rsora added the criticality: highest Of highest impact label Dec 21, 2021
@fstasi fstasi added this to the arduino-ide rc5 milestone Jan 25, 2022
@fstasi fstasi added criticality: medium Of moderate impact and removed criticality: highest Of highest impact labels Feb 16, 2022
@tigoe
Copy link
Member

tigoe commented Mar 11, 2022

This is still failing. Steps to reproduce:

  1. make a new sketch. I used AnalogReadSerial from the Basics examples
  2. upload to a board
  3. open the serial monitor
  4. make a new window
  5. make a new sketch. I made a variation on AnalogReadSerial, adding a line that printed "test"
  6. Try to upload. You will get this error:
Error: Request upload failed with message: Upload error: Failed uploading: uploading error: exit status 1

There's no indication that the open serial monitor in the other window is the problem. This will frustrate the hell out of beginners.

@fstasi fstasi modified the milestones: arduino-ide rc5, arduino-ide rc6 Mar 24, 2022
@fstasi fstasi removed this from the arduino-ide rc6 milestone May 10, 2022
@fstasi fstasi assigned AlbyIanna and unassigned fstasi May 10, 2022
@AlbyIanna AlbyIanna mentioned this issue Jun 7, 2022
4 tasks
@fstasi fstasi closed this as completed Jun 8, 2022
@per1234 per1234 added the conclusion: resolved Issue was resolved label Jun 8, 2022
@per1234 per1234 linked a pull request Jun 8, 2022 that will close this issue
4 tasks
@cnyrr
Copy link

cnyrr commented Jul 23, 2023

It is still broken. Can't upload unless serial monitor is closed.

avrdude: ser_open(): can't open device "\\.\COM6": Access is denied.
Failed uploading: uploading error: exit status 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conclusion: resolved Issue was resolved criticality: medium Of moderate impact topic: code Related to content of the project itself topic: documentation Related to documentation for the project 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.

7 participants