iovisor / iovisor/bcc

Stream Redirection Disables All Output

Open
#905 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
22.7k
Forks
4.1k
Avg merge
10d 4h
Merged PRs (30d)
3

Description

# Issue

When standard output is redirected, the Python programs output nothing.

# Details, Steps to Reproduce

I see this issue in all the executables I've tried (though haven't tested very many).

sudo tcpconnect -t # works as expected
sudo tcpconnect -t | tee tcpconnect.txt # not a peep

Seems odd... Source code shows output is happening via `print()` statements, and I don't see anything obvious in `sudo strace -o strace.txt biolatency | tee /dev/null` output (attached).

python -c 'print("test")' | tee /dev/null # works as expected

Is this expected behavior?

I don't see anything obvious when tracing with `strace`.

# Versions

* Ubuntu 16.04.1, kernel "4.4.0-59-generic"
* Python 2.7.12 (I checked the shebang line to make sure I was calling the right Python)
* BCC installed via the Ubuntu Xenial repo yesterday (2016-1-12)

[strace-redirected.txt](https://github.com/iovisor/bcc/files/705617/strace-redirected.txt)
[strace-normal.txt](https://github.com/iovisor/bcc/files/705618/strace-normal.txt)

[redirected-normal.diff.txt](https://github.com/iovisor/bcc/files/705616/redirected-normal.diff.txt)

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the behavior with tcpconnect -t and biolatency when their output is piped through tee, then compare it with direct execution and the attached strace files. Trace the Python tool entry points that emit output and verify that the tools still display their output when standard output is redirected.

Written by the indexing model from the issue text.

Assessment

Tech stack
linux, python
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.