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

Restore STDIN to blocking mode upon termination #470

Closed
recvfrom opened this issue Apr 16, 2018 · 3 comments
Closed

Restore STDIN to blocking mode upon termination #470

recvfrom opened this issue Apr 16, 2018 · 3 comments
Assignees

Comments

@recvfrom
Copy link

I've been having some problems with STDIN getting set to non-blocking mode, breaking several other commands run in that same terminal window:

https://unix.stackexchange.com/questions/437409/problems-caused-by-stdin-set-to-non-blocking-mode

I wrote a program to detect when this change happens and found that tcpreplay appears to be a cause:

$ /usr/bin/tcprewrite --version
tcprewrite version: 4.2.6 (build git:v4.2.6) (debug)
Copyright 2013-2017 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta
Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Not compiled with libdnet.
Compiled against libpcap: 1.8.1
64 bit packet counters: enabled
Verbose printing via tcpdump: enabled
Fragroute engine: disabled
Warning, STDIN in nonblock mode
$

Could tcpreplay be updated to restore the flags on STDIN (and maybe STDOUT / STDERR, if needed) upon termination? Thanks!

@fklassen fklassen self-assigned this Apr 16, 2018
@fklassen
Copy link
Member

Yeah, that should get cleaned up. Logging as a bug.

@recvfrom
Copy link
Author

I modified my test program to check STDOUT and STDERR as well, and can confirm that they also get left in non-blocking mode

$ cat /proc/self/fdinfo/0 
pos:	0
flags:	0100002
mnt_id:	25
$ cat /proc/self/fdinfo/1
pos:	0
flags:	0100002
mnt_id:	25
$ cat /proc/self/fdinfo/2
pos:	0
flags:	0100002
mnt_id:	25
$ tcprewrite --version
tcprewrite version: 4.2.6 (build git:v4.2.6-4-g54da3478)
Copyright 2013-2017 by Fred Klassen <tcpreplay at appneta dot com> - AppNeta
Copyright 2000-2012 by Aaron Turner <aturner at synfin dot net>
The entire Tcpreplay Suite is licensed under the GPLv3
Cache file supported: 04
Compiled against libdnet: 1.12
Compiled against libpcap: 1.8.1
64 bit packet counters: enabled
Verbose printing via tcpdump: enabled
Fragroute engine: enabled
$ cat /proc/self/fdinfo/0 
pos:	0
flags:	0104002
mnt_id:	25
$ cat /proc/self/fdinfo/1
pos:	0
flags:	0104002
mnt_id:	25
$ cat /proc/self/fdinfo/2
pos:	0
flags:	0104002
mnt_id:	25

@fklassen
Copy link
Member

duplicate of #416

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

No branches or pull requests

2 participants