Skip to content

Server segfault when passing channels from inner tasks #7152

Closed
@jfager

Description

@jfager

I'm running into an issue with a basic server where when I pass a channel out of a task spawned for each connection, the server will segfault on subsequent requests. I'm probably doing The Wrong Thing here, but segfaulting from code that's not marked unsafe seems like a bug.

Would also appreciate feedback on the right way to have a task per connection with some way to pump data into it.

Code recreating the issue is at https://gist.github.com/jfager/5788001, gdb backtrace below.

rust: task failed at 'option::unwrap none', /Users/jason/src/rust/src/libstd/option.rs:268
rust: domain main @0x108800010 root task failed
rust: task failed at 'killed', /Users/jason/src/rust/src/libstd/pipes.rs:286  
rust: task failed at 'killed', /Users/jason/src/rust/src/libstd/pipes.rs:286
rust: task failed at 'killed', /Users/jason/src/rust/src/libstd/pipes.rs:286
rust: task failed at 'killed', /Users/jason/src/rust/src/libstd/pipes.rs:286
rust: task failed at 'killed', /Users/jason/src/rust/src/libstd/pipes.rs:286

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x0000000000000000
[Switching to process 4603 thread 0x1703]
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000010098bcf2 in uv__io_poll () at rust_task.cpp:1327
#2  0x000000010097dac8 in uv_run () at rust_task.cpp:1327
#3  0x00000001005a0ba1 in rust_uv_run__c_stack_shim ()
#4  0x000000010097cd51 in __morestack () at rust_task.cpp:1327
#5  0x000000010096d5de in rust_task::call_on_c_stack (this=0x100a0ca20, args=0x1, fn_ptr=0x1) at rust_task.h:484
#6  0x000000010096de0f in upcall_call_shim_on_c_stack (args=0x1055ff0c8, fn_ptr=0x1055fde30) at rust_upcall.cpp:70
#7  0x000000010064d7ee in uv_iotask::spawn_iotask::anon::expr_fn_21659 ()
#8  0x0000000100660722 in uv_global_loop::spawn_loop::anon::anon::anon::expr_fn_23194 ()
#9  0x00000001001c2590 in unstable::weak_task::weaken_task::_633e817ba3eab3b9::_07pre ()
#10 0x0000000100215c2b in __morestack ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions