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

Split tokio-threadpool lib.rs into files #233

Merged
merged 4 commits into from
Mar 27, 2018

Conversation

kpp
Copy link
Contributor

@kpp kpp commented Mar 16, 2018

Move tokio-threadpool:

  • Builder -> src/builder.rs
  • Callback -> src/callback.rs
  • Config -> src/config.rs
  • Futures2Wake -> src/futures2_wake.rs
  • Inner -> src/inner.rs
  • Notifier-> src/notifier.rs
  • Sender -> src/sender.rs
  • Shutdown -> src/shutdown.rs
  • ShutdownTask -> src/shutdown_task.rs
  • SleepStack -> src/sleep_stack.rs
  • State -> src/state.rs
  • ThreadPool -> src/thread_pool.rs
  • Worker -> src/worker.rs
  • WorkerEntry -> src/worker_entry.rs
  • WorkerState -> src/worker_state.rs

@kpp
Copy link
Contributor Author

kpp commented Mar 16, 2018

@carllerche please help =)

$ RUST_BACKTRACE=1 cargo test --all
thread '<unnamed>' panicked at 'explicit panic', tokio-threadpool/tests/threadpool.rs:525:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:402
   5: std::panicking::begin_panic
             at /checkout/src/libstd/panicking.rs:365
   6: <threadpool::panic_in_task::Boom as futures_core::future::Future>::poll
             at tokio-threadpool/tests/threadpool.rs:525
   7: <futures_util::future::map_err::MapErr<A, F> as futures_core::future::Future>::poll
             at /home/humbug/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.2.0-alpha/src/future/map_err.rs:31
   8: tokio_threadpool::task::TaskFuture::poll
             at tokio-threadpool/src/task.rs:507
   9: tokio_threadpool::task::Task::run::{{closure}}
             at tokio-threadpool/src/task.rs:172
  10: core::ops::function::FnOnce::call_once
             at /checkout/src/libcore/ops/function.rs:223
  11: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /checkout/src/libstd/panic.rs:296
  12: std::panicking::try::do_call
test thread_shutdown_timeout ... ok
             at /checkout/src/libstd/panicking.rs:306
  13: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  14: std::panicking::try
             at /checkout/src/libstd/panicking.rs:285
  15: std::panic::catch_unwind
             at /checkout/src/libstd/panic.rs:361
  16: tokio_threadpool::task::Task::run
             at tokio-threadpool/src/task.rs:158
  17: tokio_threadpool::worker::Worker::run_task
             at tokio-threadpool/src/worker.rs:279
  18: tokio_threadpool::worker::Worker::try_run_task
             at tokio-threadpool/src/worker.rs:223
  19: tokio_threadpool::worker::Worker::run
             at tokio-threadpool/src/worker.rs:127
  20: tokio_threadpool::worker::Worker::spawn::{{closure}}::{{closure}}::{{closure}}
             at tokio-threadpool/src/worker.rs:87
  21: tokio_executor::global::with_default::{{closure}}
             at /home/humbug/tokio/tokio-executor/src/global.rs:176
  22: <std::thread::local::LocalKey<T>>::try_with
             at /checkout/src/libstd/thread/local.rs:290
  23: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/libstd/thread/local.rs:244
  24: tokio_executor::global::with_default
             at /home/humbug/tokio/tokio-executor/src/global.rs:150
  25: tokio_threadpool::worker::Worker::spawn::{{closure}}::{{closure}}
             at tokio-threadpool/src/worker.rs:83
  26: <std::thread::local::LocalKey<T>>::try_with
             at /checkout/src/libstd/thread/local.rs:290
  27: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/libstd/thread/local.rs:244
  28: tokio_threadpool::worker::Worker::spawn::{{closure}}
             at tokio-threadpool/src/worker.rs:74

thread 'tokio-runtime-worker-2' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at libstd/sys_common/backtrace.rs:59
             at libstd/panicking.rs:207
   3: std::panicking::default_hook
             at libstd/panicking.rs:223
   4: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:402
   5: std::panicking::begin_panic_fmt
             at libstd/panicking.rs:349
   6: rust_begin_unwind
             at libstd/panicking.rs:325
   7: core::panicking::panic_fmt
             at libcore/panicking.rs:72
   8: core::panicking::panic
             at libcore/panicking.rs:51
   9: <core::option::Option<T>>::unwrap
             at /checkout/src/libcore/macros.rs:20
  10: tokio_threadpool::task::Task::run::{{closure}}
             at tokio-threadpool/src/task.rs:172
  11: core::ops::function::FnOnce::call_once
             at /checkout/src/libcore/ops/function.rs:223
  12: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /checkout/src/libstd/panic.rs:296
  13: std::panicking::try::do_call
             at /checkout/src/libstd/panicking.rs:306
  14: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:102
  15: std::panicking::try
             at /checkout/src/libstd/panicking.rs:285
  16: std::panic::catch_unwind
             at /checkout/src/libstd/panic.rs:361
  17: tokio_threadpool::task::Task::run
             at tokio-threadpool/src/task.rs:158
  18: tokio_threadpool::worker::Worker::run_task
             at tokio-threadpool/src/worker.rs:279
  19: tokio_threadpool::worker::Worker::try_steal_task
             at tokio-threadpool/src/worker.rs:249
  20: tokio_threadpool::worker::Worker::run
             at tokio-threadpool/src/worker.rs:134
  21: tokio::runtime::Runtime::new::{{closure}}::{{closure}}
             at src/runtime.rs:240
  22: tokio_reactor::with_default::{{closure}}
             at ./tokio-reactor/src/lib.rs:203
  23: <std::thread::local::LocalKey<T>>::try_with
             at /checkout/src/libstd/thread/local.rs:290
  24: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/libstd/thread/local.rs:244
  25: tokio_reactor::with_default
             at ./tokio-reactor/src/lib.rs:195
  26: tokio::runtime::Runtime::new::{{closure}}
             at src/runtime.rs:239
  27: tokio_threadpool::callback::Callback::call
             at tokio-threadpool/src/callback.rs:21
  28: tokio_threadpool::worker::Worker::spawn::{{closure}}::{{closure}}::{{closure}}
             at tokio-threadpool/src/worker.rs:85
  29: tokio_executor::global::with_default::{{closure}}
             at ./tokio-executor/src/global.rs:176
  30: <std::thread::local::LocalKey<T>>::try_with
             at /checkout/src/libstd/thread/local.rs:290
  31: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/libstd/thread/local.rs:244
  32: tokio_executor::global::with_default
             at ./tokio-executor/src/global.rs:150
  33: tokio_threadpool::worker::Worker::spawn::{{closure}}::{{closure}}
             at tokio-threadpool/src/worker.rs:83
  34: <std::thread::local::LocalKey<T>>::try_with
             at /checkout/src/libstd/thread/local.rs:290
  35: <std::thread::local::LocalKey<T>>::with
             at /checkout/src/libstd/thread/local.rs:244
  36: tokio_threadpool::worker::Worker::spawn::{{closure}}
             at tokio-threadpool/src/worker.rs:74

@kpp kpp mentioned this pull request Mar 16, 2018
@carllerche
Copy link
Member

#243 should fix these issues.

@kpp
Copy link
Contributor Author

kpp commented Mar 23, 2018

@carllerche I rebased onto master, merged some fixes(08c21e7) into it

@seanmonstar Is it possible to base your #254 on this PR? Otherwise your authorship of the fixes will be lost in git history.

kpp added 4 commits March 24, 2018 00:30
* Builder -> src/builder.rs
* Callback -> src/callback.rs
* Config -> src/config.rs
* Futures2Wake -> src/futures2_wake.rs
* Inner -> src/inner.rs
* Notifier-> src/notifier.rs
* Sender -> src/sender.rs
* Shutdown -> src/shutdown.rs
* ShutdownTask -> src/shutdown_task.rs
* SleepStack -> src/sleep_stack.rs
* State -> src/state.rs
* ThreadPool -> src/thread_pool.rs
* Worker -> src/worker.rs
* WorkerEntry -> src/worker_entry.rs
* WorkerState -> src/worker_state.rs
    * Fix races.

    This mostly pulls in changes from rust-lang/futures-rs#881, but
    also updates Registration to be a bit more obvious as to what is going
    on.

    * Reduce spurious wakeups caused by Reactor

    This patch adds an ABA guard on token values before registering them
    with Mio. This allows catching token reuse and avoid the notification.

    This is needed for OS X as the notification is used to determine that a
    TCP connect has completed. A spurious notification can potentially cause
    write failures.
@carllerche
Copy link
Member

Thanks!

@carllerche carllerche merged commit ad18982 into tokio-rs:master Mar 27, 2018
@kpp kpp deleted the split_threadpool branch March 28, 2018 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants