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

Output from WSL command pipeline is randomly truncated #1078

Closed
petsuter opened this issue May 31, 2019 · 6 comments
Closed

Output from WSL command pipeline is randomly truncated #1078

petsuter opened this issue May 31, 2019 · 6 comments
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-WSL Issue that should probably go to Microsoft/WSL Resolution-External For issues that are outside this codebase

Comments

@petsuter
Copy link

Environment

Windows build number: 10.0.17134.765

Steps to reproduce

  • Open cmd.exe and enter the following commands:
mkdir test && cd test
FOR /L %i IN (100,1,999) DO echo %i >> data.txt
FOR /L %i IN (1,1,100) DO copy data.txt data%i.txt
wsl cat * | wsl sort | wsl uniq

Repeat the last line multiple times to repeat the problem with randomly different behavior.

Expected behavior

After the last command the terminal should display all integers from 100 to 999.

Actual behavior

After the last command the terminal only displays all integers from 100 to some random integer smaller than 999 (e.g. 978). Sometimes the last integer is not shown completely (e.g. only "97" instead of "978").


The output is truncated? One of the programs in the pipeline is aborted early? It might be a timing issue? Repeating the last command often results in the same "random" number, but sometimes it gets stops later / earlier.

Using different counts (e.g. 100 to 400 instead of 100 to 999) the problem also occurs.

Using slightly different commands the problem does not occur, e.g. this works correctly:

wsl
cat * | sort | uniq
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels May 31, 2019
@zadjii-msft
Copy link
Member

@benhillis Is this some sort of WSL bug?

It seems to occur regardless of conhost vs terminal. The fact that running cat * | sort | uniq without starting wsl each time makes me think it might be just an issue in WSL

@zadjii-msft zadjii-msft added Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-WSL Issue that should probably go to Microsoft/WSL labels May 31, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 31, 2019
@benhillis
Copy link
Member

I have seen instances of this in the past, let me see if I can still repro...

@DHowett-MSFT
Copy link
Contributor

This report is on 17134, and it seems to be related to piping from WSL to WSL. I'm going to say with 100% certainty that it's not a Console bug. 😄

@DHowett-MSFT DHowett-MSFT added Resolution-External For issues that are outside this codebase and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 2, 2019
@petsuter
Copy link
Author

petsuter commented Jun 2, 2019

Thanks all for checking. 👍 Should I reopen this issue somewhere else?

(I originally intended to open it at https://github.com/microsoft/WSL/issues/new but there it says:

If this is a console issue (a problem with layout, rendering, colors, etc.), please post to the console issue tracker.

So I did that here instead. From outside it's difficult to know if this is a rendering issue or not. For all I know it could be a bug in cat, sort, uniq, wsl, cmd or whatever else is internally involved with piping. 🤔)

Please let me know or just reopen the issue wherever the appropriate place is, thanks!

@zadjii-msft
Copy link
Member

Yea, sometimes it's really hard to tell externally if something like this is better suited for the WSL repo or the console repo. In this case, this is probably a bug with WSL itself, so it probably belongs in Microsoft/WSL

@petsuter
Copy link
Author

petsuter commented Jun 3, 2019

OK thanks, I opened a new issue there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Related to output processing (inserting text into buffer, retrieving buffer text, etc.) Issue-Bug It either shouldn't be doing this or needs an investigation. Product-WSL Issue that should probably go to Microsoft/WSL Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

4 participants