Closed wobedi closed 11 months ago
Apologies for asking you to repost your absolutely fantastic bug report but can you please move this over to the Chromium issue tracker (https://crbug.com/new) as this repository is for tracking specification work and this in an implementation issue unless we discover something about the design of the API that would have to change to prevent developers from running into this issue.
@reillyeon Thanks for the swift reply! I have now reposted it here: https://bugs.chromium.org/p/chromium/issues/detail?id=1468398
Thanks! Closing this issue. Will follow-up on the Chromium issue tracker.
Context
We use WebSerial in production for a hardware device that therapists use to provide EMDR therapy online (details).
Users buy our hardware and use our web app to control it (via WebSerial).
Upon purchase, they have to pair their device upon first use. After that first pair we auto-connect to the previously-paired device whenever they plug it in and have our web app open.
It has been working miraculously well, thank you for all the great work in enabling this! Your work has enabled tens of thousands of remote therapy sessions already :)
However, today we have observed a concerning bug with a user on an Apple M2 / MacOS13.
System Details
I have reproduced the issue with the user on their device with the following specs:
Issue
The user has one of our devices which was already-paired to their Chrome (visible when clicking the lock icon next to the URL)
The user reported that even though the device had been paired it was only connecting to our web app intermittently, and that they often needed to restart their computer in order for the web app to connect to the device.
I was able to reproduce this with the user and observed the following interesting events in the device log:
->
Failed to flush port: Device not configured (6)
when unplugging the device ->Failed to put terminal in exclusive mode: Resource busy (16)
andFailed to open serial port: FILE_ERROR_IN_USE
when replugging the deviceThis makes me wonder whether there is a bug in how WebSerial and this particular brand-new Apple M2/MacOS 13 interact, which makes the device not fully be flushed upon disconnect?
Workaround
The issue can reliably be solved by unpairing the device (via the lock icon and page load), and then pairing anew.
The first connection upon pairing always works.
But subsequent reconnections (e.g. via page reload or device unplug and replug) are flaky (they sometimes work and sometimes don't, with no recognizable pattern).
Steps to reproduce
(Educated guess based on the above observations for our use case)
Current behavior
Reconnection flaky
Expected behavior
Reconnection reliable
Notes
If anyone is keen, I'd be happy to ship them one of our devices (globally) for debugging and would also be happy to jump on a call to reproduce it together, just let me know.