dpc / mioco.pre-0.9

Scalable, coroutine-based, asynchronous IO handling library for Rust programming language. (aka MIO COroutines).
Mozilla Public License 2.0
457 stars 30 forks source link

Mioco compilation with channels and streams fails. #154

Closed SirVer closed 8 years ago

SirVer commented 8 years ago

I ran into a mioco bug where a try_read on a MioWrapper<TcpStream> blocked on me. I tried to build a minimal repro case, but while doing so I ran into another bug - so I am reporting this instead.

Compiling mioco_example v0.1.0 (file:///private/tmp/mioco_example)

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: Could not compile `mioco_example`.

The minimal repro case is this repository. The source code is this file.

This is on Mac OS with latest nighlies:

rustc 1.12.0-nightly (1bf5fa326 2016-08-16)
cargo 0.13.0-nightly (5593045 2016-08-16)
dpc commented 8 years ago

I'd be guessing that this is rustc nightly regression. Can you try with stable? I'll look into it when I get some time.

SirVer commented 8 years ago

On stable I get a different crash, but it still crashes:

$ multirust override stable
multirust: using existing install for 'stable'
multirust: override toolchain for '/tmp/mioco_example' set to 'stable'
$ cargo build --verbose
       Fresh owning_ref v0.2.0
       Fresh bitflags v0.4.0
       Fresh slab v0.2.0
       Fresh cfg-if v0.1.0
       Fresh spin v0.4.3
       Fresh void v1.0.2
       Fresh slab v0.1.3
       Fresh winapi v0.2.8
       Fresh log v0.3.6
       Fresh libc v0.2.15
       Fresh semver v0.1.20
       Fresh bytes v0.3.0
       Fresh thread-scoped v1.0.1
       Fresh winapi-build v0.1.1
       Fresh gcc v0.3.32
       Fresh net2 v0.2.26
       Fresh nix v0.5.1
       Fresh num_cpus v0.2.13
       Fresh rustc_version v0.1.7
       Fresh kernel32-sys v0.2.2
       Fresh ws2_32-sys v0.2.1
       Fresh nix v0.6.0
       Fresh context v1.0.0
       Fresh time v0.1.35
       Fresh miow v0.1.3
       Fresh mio v0.5.1
       Fresh mioco v0.8.0
   Compiling mioco_example v0.1.0 (file:///private/tmp/mioco_example)
     Running `rustc src/main.rs --crate-name mioco_example --crate-type bin -g --out-dir /private/tmp/mioco_example/target/debug --emit=dep-info,link -L dependency=/private/tmp/mioco_example/target/debug -L dependency=/private/tmp/mioco_example/target/debug/deps --extern mioco=/private/tmp/mioco_example/target/debug/deps/libmioco-cd16d77987186e28.rlib -L native=/private/tmp/mioco_example/target/debug/build/context-27e11b7b5bc898d2/out`
error: Could not compile `mioco_example`.

Caused by:
  Process didn't exit successfully: `rustc src/main.rs --crate-name mioco_example --crate-type bin -g --out-dir /private/tmp/mioco_example/target/debug --emit=dep-info,link -L dependency=/private/tmp/mioco_example/target/debug -L dependency=/private/tmp/mioco_example/target/debug/deps --extern mioco=/private/tmp/mioco_example/target/debug/deps/libmioco-cd16d77987186e28.rlib -L native=/private/tmp/mioco_example/target/debug/build/context-27e11b7b5bc898d2/out` (signal: 11, SIGSEGV: invalid memory reference)
dpc commented 8 years ago

I've filled a pull request with a workaround.

dpc commented 8 years ago

All right. I wrote a test and a proper fix. Please let me know if it works works for you. Thanks for reporting it!

SirVer commented 8 years ago

Works for me now! Thank you very much!

I am trying to repro the original bug I saw: I still see try_recv() blocking in my complex program, but I am unable to come up with a minimal repro case so far.

dpc commented 8 years ago

If you have any hints on what's going on, please let me know. I'll try to help. We can do it in separate issue - even if you don't have a minimal repro, you coud describe what you know already.