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

backgrounding and redirecting iperf3 server oddity #138

Closed
bmah888 opened this issue Feb 28, 2014 · 5 comments
Closed

backgrounding and redirecting iperf3 server oddity #138

bmah888 opened this issue Feb 28, 2014 · 5 comments

Comments

@bmah888
Copy link
Contributor

bmah888 commented Feb 28, 2014

From [email protected] on February 17, 2014 03:18:19

What steps will reproduce the problem? 1. write a script that iperf as a server and redirect its output (i.e. tee) (only way I know to monitor report server side)
2. in the script background iperf and wait for it (to handle signals)
3. launch this script itself in background (nohup if you like) What is the expected output? What do you see instead? 0. if I just launch the script (backgrounding iperf, but not the script)

  1. without --verbose nothing happens when redirecting
  2. with --verbose, the output is buffered on report ("iperf3 --server --verbose | tee /dev/stdout", shows two reports, no interleaved lines), maybe it is not really convenient but not a big deal
    1. if I background the script too, nothing works (even on client side, which is blocked) What version of the product are you using? On what operating system? iperf version 3.0.1 (10 January 2014)
      Linux sd-41347 3.2.0-4-amd64 setting of window size should be explicit #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux Please provide any additional information below. cat iperf_server.sh

!/bin/bash

while [ 0 ];
do
iperf3 --server --port 22222 --verbose | tee /tmp/iperf3.log.raw | awk '{print strftime("%F %T",systime()),$0; fflush()}' | tee /tmp/iperf3.log
wait $!
if [ $? ];
then
sleep 1;
fi;
done

and

nohup ./iperf_server.sh > /dev/stdnull &

Original issue: http://code.google.com/p/iperf/issues/detail?id=138

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From [email protected] on February 21, 2014 13:14:35

I acknowledge seeing this report.

In step 2 when you did a test doing tee to /dev/stdout, note that tee(1) send its stdin to stdout and to the file you specify, so getting two copies on stdout is expected.

It feels to me like you're seeing the effects of buffering of output in various places (particularly with the result from the test in the previous paragraph having non-interleaved lines of output) but I haven't actually experimented with this.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From [email protected] on February 21, 2014 14:26:48

This is also somewhat related to Issue 119 .

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From [email protected] on February 23, 2014 09:16:45

Hi,

I agree.

Obviously.
I wasn't clear, the issue is not that you get two reports to stdout (I wondered if they were other outputs).
The issue is that it seems that, when you redirect stdout, it needs --verbose flag to actually show message you get previously without --verbose when no redirection
no redirection and no --verbose ---> some message
no redirection and --verbose ---> more message
redirection and no --verbose ---> almost nothing
redirection and --verbose ---> everything (it seems) but buffered on reports

buffering on reports --> It seems to me that there is no fflush per iprintf call (but more likely at closing of the stream ?)
--verbose --> it seems this introduces a fflush (line 452 of iperf_server_api.c)

while my tee is line buffered:
sh -c "date; sleep 1; date" | tee -

correctly print two identical lines then wait 1 sec before printing two identicals lines

maybe this has to do with some buffering options set on the fd for stdout.

I agree.

Thanks for your work.

@bmah888
Copy link
Contributor Author

bmah888 commented Feb 28, 2014

From [email protected] on February 23, 2014 09:21:38

This might be an interesting pointer http://stackoverflow.com/questions/13932932/why-does-stdout-need-explicit-flushing-when-redirected-to-file

@bmah888
Copy link
Contributor Author

bmah888 commented May 12, 2014

Closing this issue for now, not an iperf3 problem and lack of further feedback.

@bmah888 bmah888 closed this as completed May 12, 2014
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

1 participant