-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Segfault with rayon & moka #495
Comments
Hi. Thanks for reporting the issue. I tried your code briefly before going to work, but I am afraid I could not reproduce it. It crashes, but for a different reason than you mentioned: $ cargo run --release
thread '<unknown>' has overflowed its stack
fatal runtime error: stack overflow
zsh: abort cargo run --release I gave the names to the Rayon threads: diff --git a/src/main.rs b/src/main.rs
index 704224a..9cd14fb 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -12,6 +12,7 @@ fn main() {
.build();
rayon::ThreadPoolBuilder::new()
.num_threads(4)
+ .thread_name(|thread_id| format!("rayon-thread-{thread_id}"))
.exit_handler(|thread_id| {
println!("Thread '{}' exited", thread_id);
}) thread 'rayon-thread-3' has overflowed its stack
fatal runtime error: stack overflow Then I tried increasing the stack size of the threads: rayon::ThreadPoolBuilder::new()
.num_threads(4)
+ .thread_name(|thread_id| format!("rayon-thread-{thread_id}"))
+ .stack_size(6 * 1024 * 1024)
.exit_handler(|thread_id| {
println!("Thread '{}' exited", thread_id);
}) thread 'rayon-thread-0' has overflowed its stack
fatal runtime error: stack overflow I found that it runs fine when I increase the stack size to 7MB: rayon::ThreadPoolBuilder::new()
.num_threads(4)
+ .thread_name(|thread_id| format!("rayon-thread-{thread_id}"))
+ .stack_size(7 * 1024 * 1024)
.exit_handler(|thread_id| {
println!("Thread '{}' exited", thread_id);
}) $ cargo run --release
...
$ echo $?
0 It seems that the spawned async tasks build up on the Rayon stack quickly(?). Can you please check if this works for you as well? You might also want to try increasing the stack size of the Rayon threads in your real program? Environment:
|
I ran it on Linux x86_64 and got the same stack overflow. It fixed after increasing the stack size to 6MB. I think the following Rayon issues would explain the reason for the stack overflow errors:
From 854,
|
Thanks, i think you're right and this can be closed. |
crossbeam-rs/crossbeam#1175
CC: @polachok
The text was updated successfully, but these errors were encountered: