file-descriptors remain open when stop() is called
See original GitHub issueMininet does not close all file descriptors if it is stopped by function Mininet.stop()
. This is because the pipes of the Pseduo-TTY remain open when the network shuts down. Implementation of Node.startShell()
opens these pipes, but they are not closed when the network is stopped:
self.master, self.slave = pty.openpty()
self.shell = self._popen( cmd, stdin=self.slave, stdout=self.slave, stderr=self.slave,
close_fds=False )
self.stdin = os.fdopen( self.master, 'rw' )
A possible solution for this bug could be an extension of Node.cleanup()
:
def cleanup( self ):
self.shell = None
"""close pipes of shell"""
if self.master:
os.close(self.master)
self.master = None
if self.slave:
os.close(self.slave)
self.slave = None
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
What happens to file descriptors when the process is killed?
Yes, the file will be automatically closed when the process terminates, regardless of the reason for the process termination.
Read more >Why should I close all file descriptors after calling fork() and ...
If you don't want to close all file descriptors in a loop on macOS, your only option is to not use fork() /...
Read more >Using file descriptors - IBM
A file descriptor is an unsigned integer used by a process to identify an open file.
Read more >File descriptor - Wikipedia
In Unix and Unix-like computer operating systems, a file descriptor (FD, less frequently fildes) is a process-unique identifier (handle) for a file or...
Read more >open(2) - Linux manual page - man7.org
The return value of open() is a file descriptor, a small, nonnegative integer that is an index to an entry in the process's...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The problem is actually not the master, but
stdin
When bothslave
andstdin
are closed, it works:closing - fixed in master