ConPty somethimes hangs when calling ClosePseudoConsole, (pseudo console created with PSUEDOCONSOLE_INHERIT_CURSOR) #22068

Open
opened 2026-01-31 08:02:34 +00:00 by claunia · 0 comments
Owner

Originally created by @FrancescElies on GitHub (Aug 9, 2024).

Other Software

wezterm 20240807-131622-ee063330

I am opening an issue here because as I understood conpty code lives here in this repo

Steps to reproduce

Sadly we couldn't manage to get consistent way to reproduce this.

We see wezterm in windows sometimes hanging when closing panes, e.g. https://github.com/wez/wezterm/issues/5882

I am suspecting this might be related to https://github.com/microsoft/terminal/issues/1810

this comment points out to a race condition, when ConPTY is being started with CreatePseudoConsole() with the flag PSEUDOCONSOLE_INHERIT_CURSOR (which wezterm does) this kind of fit with the fact we can't consistenly reproduce this issue.

Here the start call in wezterm.
image

Actual Behavior

ClosePseudoConsole hangs

Originally created by @FrancescElies on GitHub (Aug 9, 2024). ### Other Software wezterm 20240807-131622-ee063330 I am opening an issue here because as I understood conpty code lives [here](https://github.com/microsoft/terminal/tree/main/samples/ConPTY/EchoCon) in this repo ### Steps to reproduce Sadly we couldn't manage to get consistent way to reproduce this. We see wezterm in windows sometimes hanging when closing panes, e.g. https://github.com/wez/wezterm/issues/5882 I am suspecting this might be related to https://github.com/microsoft/terminal/issues/1810 [this comment](https://github.com/microsoft/terminal/issues/1810#issuecomment-518876493) points out to a race condition, when ConPTY is being started with `CreatePseudoConsole()` with the flag `PSEUDOCONSOLE_INHERIT_CURSOR` (which wezterm does) this kind of fit with the fact we can't consistenly reproduce this issue. [Here](https://github.com/wez/wezterm/blob/56a27e93a9ee50aab50ff4d78308f9b3154b5122/pty/src/win/psuedocon.rs#L83-L91) the start call in wezterm. ![image](https://github.com/user-attachments/assets/135ba20d-ea80-4d1d-b250-0f06287f97d4) ### Actual Behavior `ClosePseudoConsole` hangs
claunia added the Needs-TriageIssue-Bug labels 2026-01-31 08:02:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22068