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 · 0 comments
Open

Hanging promise after close() in flowing mode #2776

jichu4n opened this issue Apr 12, 2024 · 0 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

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

1 participant