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

Same run, Different ouputs #1854

Closed
frntn opened this issue Jul 28, 2015 · 5 comments
Closed

Same run, Different ouputs #1854

frntn opened this issue Jul 28, 2015 · 5 comments

Comments

@frntn
Copy link

frntn commented Jul 28, 2015

What I do

Trying to cargo test against some code

What I got

Don't freak out the underlying error is coherent and is exactly the same :)
BUT
The ouput may appear broken like if two threads are writing to stdout at the same time, so the output variants appear to be infinite like these :

# RUN KO 1
→ cargo test
   Compiling lists v0.1.0 (file:///lab/rust/lists)
src/second.rs:56:6: 56:7 src/second.rs:56:6: 56:7 error: expected ident, found `&`error: 
expected ident, found `&`
src/second.rs:56 src/second.rs:impl<&T> Iterator for List<&T> {
56 impl<&T> Iterator for List<&T> {                      
                      ^
^
Build failed, waiting for other jobs to finish...
Could not compile `lists`.

# RUN KO 2
→ cargo test
   Compiling lists v0.1.0 (file:///lab/rust/lists)
src/second.rs:56:6: 56:7src/second.rs:56:6: 56:7  error: error: expected ident, found `&`
expected ident, found `&`src/second.rs:56
 impl<&T> Iterator for List<&T> {
src/second.rs                      :56^ impl<&T> Iterator for List<&T> {

                      ^
Build failed, waiting for other jobs to finish...
Could not compile `lists`.

# RUN KO 3
→ cargo test
   Compiling lists v0.1.0 (file:///lab/rust/lists)
src/second.rs:56:6: 56:7src/second.rs:56:6: 56:7  error: error: expected ident, found `&`
src/second.rs:56expected ident, found `&` impl<&T> Iterator for List<&T> {

^
src/second.rs:56 impl<&T> Iterator for List<&T> {

# etc...

Note: No code change or anything between the runs. Just re-exec build test

This messes up understanding, indicators and maybe colors...

What I expected

What I end up with on some runs :

# RUN OK 
   Compiling lists v0.1.0 (file:///lab/rust/lists)
src/second.rs:56:6: 56:7 error: expected ident, found `&`
src/second.rs:56 impl<&T> Iterator for List<&T> {
                      ^
src/second.rs:56:6: 56:7 error: expected ident, found `&`
src/second.rs:56 impl<&T> Iterator for List<&T> {
                      ^
Build failed, waiting for other jobs to finish...
Could not compile `lists`.

How to reproduce

The code used for the code samples of this issue (generating these errors) is available here : https://gist.github.com/frntn/e9e5652c12fdc931315d


Ubuntu 14.04.2 LTS
rustc 1.1.0 (35ceea399 2015-06-19)
cargo 0.2.0-nightly (a483581 2015-05-14) (built 2015-05-15)

@alexcrichton
Copy link
Member

This is actually intentional because Cargo is running the compiler in parallel behind the scenes. For more info see this comment: #1717 (comment)

@frntn
Copy link
Author

frntn commented Jul 29, 2015

This is actually intentional

hmmm...
What's intentional here is running the compiler in parallel, not having a mixed ouput.
Am I right ? (I'm confident you'll answer yes to this one, so I proceed)

If so, this is actually an issue!

I know everybody is working hard on developing Cargo and making it a top level tool, but this kind of output behavior + your answer can scare people out and make them loose confidence about the way Cargo and Rust are developped.
Don't misunderstand me here : I believe they would be wrong!

Resolution patterns :
I am thinking of other tools using parallel runs and concurrent ouput like Packer for example. They have choosen to control their mixed ouput by lines, with each line prefixed by some identifier with a distinct color.

I haven't done any research about that, but I'm pretty sure we can find other implementations to solve this concurrent ouput issue.

@alexcrichton
Copy link
Member

Ok, seems reasonable to consider the symptom solvable without not parallelizing.

@MrSapps
Copy link

MrSapps commented Sep 11, 2015

MsBuild solves this problem by numbering the "node/thread/compiler" instances. So you'll see something like

1> foo.cpp
2> bar.cpp

@alexcrichton
Copy link
Member

Ah I think this is a dupe of #1198 which is also about interleaving output

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

No branches or pull requests

3 participants