Rust-Mioco: mioco — Scalable, coroutine-based, asynchronous IO handling library

Travis CI Build Status App Veyor Build Status crates.io Gitter Chat
Documentation

mioco

Mioco provides green-threads (aka fibers) like eg. Goroutines in Go, for Rust.

Status

This repo is a complete re-implementation of mioco. The code of previous versions was moved to mioco.pre-0.9.

The goals of new implementation:

  • switch to latest mio version
  • copy all the applicable good ideas from tokio reactor code
  • simplify the approach
    • remove the exposed scheduler
  • model the API to be more like std library, less like mio
  • focus on synchronization primitives first
  • support async file IO (via worker threads)
  • port all the existing mioco features, tests, examples etc.

Comments

  • documentation 404's
    documentation 404's

    Apr 30, 2017

    That's about it

    Both on crates.io and in the Readme.md

    Reply
  • http-server example seems to hang under ApacheBench
    http-server example seems to hang under ApacheBench

    May 1, 2017

    First off, thanks for mioco!

    Steps to reproduce from b8cc872fa1e5d127b2b4c60cdd133ee7aadd22f2 (macOS 10.12.4, macbook pro with 4 cores):

    $ cargo build --example http-server
    $ target/debug/examples/http-server&
    $ ab http://127.0.0.1:5555/
    
    This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
    Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
    Licensed to The Apache Software Foundation, http://www.apache.org/
    
    Benchmarking 127.0.0.1 (be patient)...apr_pollset_poll: The timeout specified has expired (70007)
    Total of 1 requests completed
    

    Sending single requests via telnet or Chrome works fine. I think it has to do with not closing the connection here: https://github.com/dpc/mioco/blob/master/examples/http-server.rs#L68

    If I add a return Ok(()) there, ab works intermittently. It hangs every few requests.

    Reply
  • Is it possible to write a efficient crawler with this tool?
    Is it possible to write a efficient crawler with this tool?

    Jun 8, 2017

    Or should I use another tool?

    Reply
  • mioco fails to build due to
    mioco fails to build due to "can't leak private type"

    Feb 28, 2018

    We getting this error when compiling mioco on Rust1.24

    private type src::sync::mpsc::ReceiverCore<T> in public interface --> /home/cooldude/.cargo/registry/src/github.com-1ecc6299db9ec823/mioco-0.8.1/src/sync/mpsc.rs:35:5 | 35 | type Raw = ReceiverCore; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type

    error[E0446]: private type src::timer::TimerCore in public interface --> /home/cooldude/.cargo/registry/src/github.com-1ecc6299db9ec823/mioco-0.8.1/src/timer.rs:47:5 | 47 | type Raw = TimerCore; | ^^^^^^^^^^^^^^^^^^^^^ can't leak private type

    error: aborting due to 2 previous errors

    error: Could not compile mioco.

    Reply
  • Update dependencies
    Update dependencies

    Mar 10, 2019

    This PR updates the dependencies to newer versions.

    The Context crate version 2 makes all calls unsafe. I therefore just wrapped all calls to Context::new and resume into an unsafe block.

    The PR also removes a the printerrln macro from latency.rs, as it is not needed anymore.

    Reply
  • Update code for rust 1.30.1 and remove unused macro
    Update code for rust 1.30.1 and remove unused macro

    Feb 28, 2019

                                                                                                                                                                                                           
    Reply
  • chore: adapt to slab 0.4.0
    chore: adapt to slab 0.4.0

    Nov 5, 2017

    Since slab 0.4.0, Slab.insert() !panic on error instead of returning a Result.

    Reply
  • panic with the below test some times
    panic with the below test some times

    Apr 22, 2017

    RUST_BACKTRACE=1 cargo test tx_inside_rx_inside_mioco

    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/mioco-5839952be6ccc31d
    

    running 0 tests

    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured

     Running target/debug/deps/mpsc-acbd32c7554c8ddd
    

    running 1 test Apr 23 01:07:25.784 DEBG Creating mioco instance, mioco: 0.9.0-pre

    thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Empty', src/libcore/result.rs:859
    note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
    stack backtrace:
       0: <core::result::Result<T, E>>::unwrap
       1: mpsc::tx_inside_rx_inside_mioco::{{closure}}
       2: mioco::Fiber::new::{{closure}}::{{closure}}
       3: <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once
       4: std::panicking::try::do_call
       5: __rust_maybe_catch_panic
       6: std::panicking::try
       7: std::panic::catch_unwind
       8: mioco::Fiber::new::{{closure}}
       9: <mioco::thunk::Thunk<'a, (), R>>::new::{{closure}}
      10: <F as mioco::thunk::Invoke<A, R>>::invoke
      11: <mioco::thunk::Thunk<'a, A, R>>::invoke
      12: mioco::context_function
    

    test tx_inside_rx_inside_mioco ... ok

    test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured

    Reply
  • some functional tests for mpsc
    some functional tests for mpsc

    Apr 22, 2017

    planning to segregate functional tests by module.

    Reply
  • Sync sender
    Sync sender

    Apr 29, 2017

    @dpc Will add more tests if this approach is ok

    Reply