[Bug]: Serial connection not closed when disconnecting in the Web Client

Open
#1,437 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

  • #1480 by @ayushdwivedi-stack — closed without merging

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
react, typescript
Domain
frontend

Research direction

Start at the serial disconnect flow and the fromDevice.cancel() call; the issue provides no file or test path, so first locate the disconnect handler and its stream cleanup logic. Reproduce using the listed serial-device steps, then verify disconnect releases the connection and reconnect no longer hangs without a page refresh.

Written by the indexing model from the issue text.

Description

bug stale
Before submitting
  • I have searched existing issues to make sure this bug hasn't already been reported
  • I have updated to the latest version of the software to verify the issue still exists
  • I have cleared cache/cookies/storage or tried in a private/incognito window (if applicable)
Hardware

Seeed Studio T1000-e

Connection Type

Serial

Local or Hosted

https://client.meshtastic.org

Firmware Version

2.7.26.54e08d8

Operating System

Windows 11

Browser

Chrome 153.0.8010.48 (Official Build) (64-bit)

Expected Behavior

When the Disconnect button is used, the underlying serial connection should be closed, so that it is free for other processes to use.

Actual Behavior

When the Disconnect button is used, the fromDevice.cancel() throws an error:
Failed to execute 'cancel' on 'ReadableStream': Cannot cancel a locked stream.
The underlying connection stays open, and packets continue to be received.

As the web client page believes the connection to be closed, trying to connect again results in it appearing to hang (See #960)

The only way to release the connection is to refresh the page or close the browser tab.

Steps to Reproduce
  1. Connect to Meshtastic device on Serial
  2. Wait for the connection to succeed
  3. Return to the devices page
  4. Click the Disconnect button
  5. Try to Connect , watch it hang
Relevant console output
16:03:10:421	DEBUG	[iMeshDevice]	Disconnect 🔌 Disconnecting from device
Error closing serial port: TypeError: Failed to execute 'close' on 'SerialPort': Cannot cancel a locked stream
Could not cleanly disconnect serial port: TypeError: Failed to execute 'close' on 'SerialPort': Cannot cancel a locked stream

16:03:10:428	INFO	[iMeshDevice]	ConnectionStatus 🔗 DeviceDisconnected (user)
index-DoHPLyNc.js:185 Error closing port before reconnect: TypeError: Failed to execute 'close' on 'SerialPort': Cannot cancel a locked stream

[useConnections] Starting configuration

16:03:15:178	DEBUG	[iMeshDevice]	Configure ⚙️ Requesting device configuration
ncaught (in promise) TypeError: Failed to execute 'pipeThrough' on 'ReadableStream': Cannot pipe a locked stream
Screenshots
Image
Additional Context

The console output is actually taken from the newer https://client-test.meshtastic.org/

Dominant language
TypeScript
Stars
861
Forks
316
Avg merge
2d 10h
Merged PRs (30d)
18

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from meshtastic/web

All issues in meshtastic/web

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.