Skip to content

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

Closed
@jdm

Description

@jdm
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions