Menu

#2 blocks forever in Ssh.close() if two or more instances used

open
nobody
None
5
2007-01-24
2007-01-24
No

If you create more than one instances of pyssh,Ssh in the same process, then the process hangs when you close() any of them.

The problem is that each instance registers a signal handler to handle SIGCHLD, so each of them sees the signal, and each of them calls a blocking os.waitpid() on the pid its own SSH process. When the first SIGCHLD arrives, all the instances call a blocking os.waitpid(), even those which do not expect their SSH subprocess to exit.

The solution is to use a nonblocking os.waitpid() call.

Discussion

  • Norbert Buchmüller

    example code that fails because of this bug

     
  • Norbert Buchmüller

    patch to fix the bug

     
  • Norbert Buchmüller

    Logged In: YES
    user_id=1700532
    Originator: YES

    File Added: pyssh0.3-sighandler_bug.diff

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.