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

Hanging promise after close() in flowing mode #2776

Open
jichu4n opened this issue Apr 12, 2024 · 2 comments
Open

Hanging promise after close() in flowing mode #2776

jichu4n opened this issue Apr 12, 2024 · 2 comments

Comments

@jichu4n
Copy link

jichu4n commented Apr 12, 2024

SerialPort Version

12.0.0

Node Version

v18.18.2

Electron Version

No response

Platform

Linux devfox 6.8.2-arch2-1 #1 SMP PREEMPT_DYNAMIC Thu, 28 Mar 2024 17:06:35 +0000 x86_64 GNU/Linux

Architecture

x64

Hardware or chipset of serialport

Prolific Technology, Inc. PL2303 Serial Port / Mobile Phone Data Cable

What steps will reproduce the bug?

  1. Attach a USB-to-serial adapter to the computer and leave the serial port side disconnected so no data is available to read.
  2. Create a SerialPort instance and attach a data callback: serialport.on('data', (data) => { ... }).
  3. Wait a few seconds, then close the SerialPort instance: serialport.close(...). (Adding pause() or destroy() produces the same result)

Minimal repro: serialport-test.ts

What happens?

Even after calling close() or destroy(), the promise created on unix-read.ts:41 never resolves / rejects. As a result, Node.js is prevented from exiting indefinitely.

See sample output from the minimal repro program above.

What should have happened?

The program should be able to exit cleanly after close() / destroy() is called.

Additional information

No response

@rotu
Copy link
Contributor

rotu commented Jun 24, 2024

Possibly resolved by #2831

@xty19
Copy link

xty19 commented Jul 12, 2024

SerialPort Version
12.0.0

Node Version
V18.16.1 (MACOS) V20.15.0(WIN10,WIN11 )

Electron Version
No response

Platform
MACOS12.1 WIN11 WIN10

Architecture
x64

Hardware or chipset of serialport
FT232R USB UART

I use serialport and I use it in node-red MACOS OS,and it runs good. But when It runs on WIN10 or WIN11 , it occurs some problems. ACCESS DENIED. It took me 3days ,and finally I found .When I close the port ,even await ,It still cant close clearly.I have to add some delay to solve the problem.
So can anyone find the solution?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants