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

PtyProcess is leaking conhosts #484

Open
deathaxe opened this issue Dec 16, 2024 · 2 comments
Open

PtyProcess is leaking conhosts #484

deathaxe opened this issue Dec 16, 2024 · 2 comments

Comments

@deathaxe
Copy link

It seems, required conhost processes to run a shell interpreter are not terminated after closing a terminal session.

Actually initial call opens 2 conhosts. Each subsequent session spawns another one, even though previous one is closed.

Steps:

  1. Open Windows task manager

    0 conhost.exe processes running

  2. Invoke:

    >>> from winpty import PtyProcess
    >>> proc = PtyProcess.spawn('python')
    >>> proc.close()
    

    2 conhost.exe processes running

  3. Invoke:

    >>> proc = PtyProcess.spawn('python')
    >>> proc.close()
    

    3 conhost.exe processes running

  4. Invoke:

    >>> proc = PtyProcess.spawn('python')
    >>> proc.close()
    

    4 conhost.exe processes running

  5. ...

@kaste
Copy link

kaste commented Dec 16, 2024

I also wanted to point that out that you never touch self.pty in close. https://github.com/andfoy/pywinpty/blob/main/winpty/ptyprocess.py#L152 is commented but was in there before, I couldn't find a commit which explains this call had to be removed. I would have expected that https://github.com/andfoy/winpty-rs/blob/main/src/pty/base.rs#L673-L674 must be executed on gc (is it?) but you also pass it to a daemon thread. Maybe the daemon never stops?

kaste added a commit to kaste/channel that referenced this issue Dec 16, 2024
pywinpty dropped support for python 3.8 but all current versions have
important issues.

- andfoy/pywinpty#463
- andfoy/pywinpty#484
- andfoy/pywinpty#483
@deathaxe
Copy link
Author

Yet another example for Rust not being the holy grale.

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

No branches or pull requests

2 participants