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

Segfault when sending a value over a channel moved inside of a loop in a task #13722

Closed
jdm opened this issue Apr 24, 2014 · 2 comments
Closed
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@jdm
Copy link
Contributor

jdm commented Apr 24, 2014

use std::task;
use std::comm;

fn main() {
    let (chan, port) = comm::channel();
    task::spawn(proc() {
        loop {
            let chan = chan;
            chan.send(());
        }
    });
    port.recv();
}
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7fcd700 (LWP 10344)]
0x000000000041301d in comm::oneshot::Packet$LT$T$GT$::sent::h852a2658987e2cecAFb::v0.0 ()
(gdb) bt
#0  0x000000000041301d in comm::oneshot::Packet$LT$T$GT$::sent::h852a2658987e2cecAFb::v0.0 ()
#1  0x000000000041265f in comm::Sender$LT$T$GT$::try_send::h845b6b74fd3211aaDAb::v0.0 ()
#2  0x0000000000412413 in comm::Sender$LT$T$GT$::send::hce4dae123e5d5ea7gAb::v0.0 ()
#3  0x0000000000412066 in main::closure.2162 ()
#4  0x0000000000448868 in task::spawn_opts::closure.7486 ()
#5  0x00000000004dfd33 in rt::task::Task::run::closure.40680 ()
#6  0x00000000004eac3c in rust_try ()
#7  0x00000000004dfb92 in rt::task::Task::run::h122390209273cc84148::v0.10.pre ()
#8  0x00000000004486db in task::spawn_opts::closure.7459 ()
#9  0x00000000004e30bf in rt::thread::thread_start::hb5fdcc7bdfadbb4etL9::v0.10.pre ()
#10 0x0000003a5e607d15 in start_thread (arg=0x7ffff7fcd700) at pthread_create.c:308
#11 0x0000003a5def253d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:114
@jdm jdm added the I-crash label Apr 24, 2014
@jdm
Copy link
Contributor Author

jdm commented Apr 24, 2014

Everything here is necessary - if there's no loop, it works fine. If there's no task, I get 'use of partially moved value: chan'.

@alexcrichton
Copy link
Member

Closing, this looks like a compiler that doesn't have #13413 just yet (repeatedly moving out of a local causes the segfault).

You'll want to lift the assignment out of the loop.

arcnmx pushed a commit to arcnmx/rust that referenced this issue Dec 17, 2022
Add VS Code schema validation for `rust-project.json`

Now that SchemaStore/schemastore#2628 has been merged, adding the `jsonValidation` contribution to the VS Code extension for better editor support when modifying `rust-project.json` files.

Related issue: rust-lang#13714
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 28, 2024
…ang#13722)

Fix rust-lang#13706

changelog: [`trait_duplication_in_bounds`]: fix ICE on duplicate type or
constant bound
flip1995 pushed a commit to flip1995/rust that referenced this issue Nov 28, 2024
…g#13723)

changelog: [`trait_duplication_in_bounds`]: trigger on duplicate const
associated constraint as well

~~The first commit is part of rust-lang#13722 which must be merged first.~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants