-
Notifications
You must be signed in to change notification settings - Fork 31
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
Valgrind throwing lots of errors #15
Comments
Ah, it seems that nearly every call in this crate will generate a "Invalid read" or "Use of uninitialised value". Could you please first try to use valgrind to test this simple example program? Let's see whether the problem is in the |
Both I also tried out a slightly modified fn main() {
let mut coros: Vec<Coroutine<i32>> = (0..20).map(|_| Coroutine::spawn(|me| {
for num in 0..2 {
me.yield_with(num);
}
})).collect();
for num in 0..3 {
for coro in coros.iter_mut() {
println!("{:?}", coro.next());
}
}
} which also runs without errors... |
That is weird. Is it possible that because of the user space context switching confuses the Valgrind? |
I suppose valgrind should be smarter than that! But I'm not experienced in either domains, so can't say for sure! |
I am now focusing on refactoring the I/O module, so I will be happy if you can help to debug :) |
I will be happy to help. But, currently, I have no idea how |
I ran it again with
which is this statement: mov (RUSTRT_RSP*8)(ARG1), %rsp And a very few others such as:
The last two are not even related to |
mov (RUSTRT_RSP*8)(ARG1), %rsp This line is used for restoring the
So these three errors are all related. But I don't know which one is uninitialised. |
Another observation: if I reduce the |
Why not try to disable the stack cache. https://github.com/zonyitoo/context-rs/blob/master/src/stack.rs#L157 Just try to set |
Unfortunately, increasing it or disabling it made no difference. The total stack size without "errors" is just nearly 2 MB; or more precisely, 2 "stacks" less than 2 MB for 256 KB (6 coroutines without errors), 128 KB (14) and 64 KB (30) stack sizes; but 3 "stacks" less for 32 KB (61) stack size. |
Well, I have no idea what happened right now. Help wanted. |
@critiqjo @zonyitoo Did you guys use debug or release builds while testing this with valgrind? In the latter case this might be the issue: rust-lang/rust#5856 (comment) |
If you use release builds for testing, you would find no symbols in the output logs... Or you could use |
Sorry for the late reply. I'm not able to test the original example in the machine I use now -- panics on Though, if I remember correctly, I got those valgrind errors for both debug and release builds, and I definitely didn't use |
|
In the latest commit in |
Well that's kinda unexpected but still very very nice. 👍 |
I think the previous logs about |
When the number of coroutines spawned is greater than a certain value, a lot of "use of uninitialized value" errors are thrown by valgrind.
Errors are thrown only when 15 or more coroutines are spawned:
If there are more workers, I can spawn more coroutines without errors, but I do reach a limit (eg. 19 for 2 workers). Despite these errors, the program gives the expected output, and exits without any segfaults.
Here are a few lines (out of 11901) from the log:
The text was updated successfully, but these errors were encountered: