Skip to content

Pseudo-terminal (pty) devices stay open/allocated after run() finishes #518

@bitprophet

Description

@bitprophet

This is circumstantial, but I had a funky issue today that seems possibly Invoke's fault:

  • Started getting Device not configured errors when trying to open new tmux windows or panes
  • Couldn't figure out what I'd been doing that would hold open too many file descriptors or terminals
  • Realized I had inv watch-docs (from invocations, which uses watchdog to basically run the docs.build task - which calls Sphinx, via run(..., pty=True), on any file change) running and perhaps it was not closing out resources correctly
  • Closed it and the issue immediately resolved, so that's suspicious
  • Question is then why it would be holding too many resources open? Shouldn't the forks created in Local via pty.fork disappear once we're done? Ditto the actual pseudo-terminals themselves?
  • Seems likely that we're missing some cleanup that needs to run and it's simply undetected due to so few single Invoke sessions spawning that many ptys
    • Could also be some issue more specific to either the invocations watch module, or watchdog itself, though this seems less likely
    • Certainly a workaround for this specific issue would be to call Sphinx in-python instead of incurring a new shell/subprocess, but that's not the point here...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions