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

Add test case for deregister then slab remove #265

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@hjr3
Contributor

hjr3 commented Sep 9, 2015

Test a condition where a connection reregisters itself and then later
deregisters itself and removes itself from the connection slab. When
this happens, mio will still try and handle events for that
token/connection when using kqueue.

Note: if the connection deregisters and does not remove itself from
the connection slab, then mio will not try and handle events for that
token/connection when using kqueue.

Note: this does not seem to matter when using epoll.

Log of test failure:

$ RUST_LOG=trace RUST_BACKTRACE=1 cargo test test_deregister_remove::test_deregister_remove

running 1 test
DEBUG:test::test_deregister_remove: Starting TEST_REGISTER_REMOVE
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(18446744073709551615); interests=Readable | Writable
INFO:test::test_deregister_remove: listen for connections
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(0); interests=Readable
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(1); interests=Writable
TRACE:mio::event_loop: event loop tick
TRACE:mio::event_loop: event=IoEvent { kind: Writable, token: Token(18446744073709551615) }
TRACE:mio::event_loop: event=IoEvent { kind: Readable, token: Token(0) }
DEBUG:test::test_deregister_remove: server accepting socket
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(2); interests=Readable
TRACE:mio::event_loop: event=IoEvent { kind: Writable, token: Token(1) }
DEBUG:test::test_deregister_remove: client socket writable
DEBUG:test::test_deregister_remove: WROTE=Ok(Some(1)) bytes
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(1); interests=Writable
TRACE:mio::timer: tick_to; now=0; tick=0
TRACE:mio::timer: ticking; curr=Token(18446744073709551615)
TRACE:mio::event_loop: event loop tick
TRACE:mio::event_loop: event=IoEvent { kind: Readable, token: Token(2) }
DEBUG:test::test_deregister_remove: server conn readable; tok=Token(2)
DEBUG:test::test_deregister_remove: READ=Some(1)
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(2); interests=Readable
TRACE:mio::poll: deregistering IO with poller
TRACE:mio::event_loop: event=IoEvent { kind: Writable, token: Token(1) }
DEBUG:test::test_deregister_remove: client socket writable
DEBUG:test::test_deregister_remove: WROTE=Ok(Some(1)) bytes
TRACE:mio::poll: registering with poller
TRACE:mio::sys::unix::kqueue: registering; token=Token(1); interests=Writable
TRACE:mio::timer: tick_to; now=0; tick=1
TRACE:mio::event_loop: event loop tick
TRACE:mio::event_loop: event=IoEvent { kind: Readable | Writable, token: Token(2) }
DEBUG:test::test_deregister_remove: server conn readable; tok=Token(2)
test test_deregister_remove::test_deregister_remove ... FAILED

failures:

---- test_deregister_remove::test_deregister_remove stdout ----
    thread 'test_deregister_remove::test_deregister_remove' panicked at 'invalid index', ../src/libcore/option.rs:332

stack backtrace:
   1:        0x10bb3d850 - sys::backtrace::tracing::imp::write::h5eae06ee4288506cVks
   2:        0x10bb40cab - panicking::on_panic::hf2970156b8548126NXw
   3:        0x10bb32582 - rt::unwind::begin_unwind_inner::h5c58ec90c1a4644c0sw
   4:        0x10bb32c0d - rt::unwind::begin_unwind_fmt::h5a6da7c1a29307d36rw
   5:        0x10bb40957 - rust_begin_unwind
   6:        0x10bb61b80 - panicking::panic_fmt::h272a520f43a4257f8PE
   7:        0x10ba3cb6c - option::Option<T>::expect::h15973906137350301830
   8:        0x10ba3ca47 - Slab<T, I>.ops..IndexMut<I>::index_mut::h15229310430276528471
   9:        0x10ba3c51b - test_deregister_remove::Server::readable::h63e20da2f6478ec5fVd
  10:        0x10ba3f64e - test_deregister_remove::TestHandler.Handler::ready::h91d81e079a529321E3d
  11:        0x10ba420e3 - event_loop::EventLoop<H>::io_event::h17124134394579665990
  12:        0x10ba42074 - event_loop::EventLoop<H>::io_process::h4946922162973064403
  13:        0x10ba41c03 - event_loop::EventLoop<H>::run_once::h7428217901890795507
  14:        0x10ba41561 - event_loop::EventLoop<H>::run::h8504926306627181909
  15:        0x10ba40637 - test_deregister_remove::test_deregister_remove::h749418ad0e9878beM5d
  16:        0x10ba78ebb - boxed::F.FnBox<A>::call_box::h1114553862285000087
  17:        0x10ba7bc55 - boxed::F.FnBox<A>::call_box::h10881169691237074744
  18:        0x10ba79602 - rt::unwind::try::try_fn::h1415043113644552063
  19:        0x10bb40908 - __rust_try
  20:        0x10bb3cd20 - rt::unwind::try::inner_try::h445685aa67c6bfc0Tow
  21:        0x10ba797b2 - boxed::F.FnBox<A>::call_box::h16827267939334967293
  22:        0x10bb3fcbd - sys::thread::Thread::new::thread_start::h2921c73b7c72e024BNv
  23:     0x7fff8bc27059 - _pthread_body
  24:     0x7fff8bc26fd6 - _pthread_start


failures:
    test_deregister_remove::test_deregister_remove

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

DEBUG:cargo: handle_error; err=CliError { error: , unknown: false, exit_code: 101 }
Add test case for deregister then slab remove
Test a condition where a connection reregisters itself and then later
deregisters itself and removes itself from the connection slab. When
this happens, mio will still try and handle events for that
token/connection when using kqueue.

Note: if the connection deregisters and does _not_ remove itself from
the connection slab, then mio will not try and handle events for that
token/connection when using kqueue.

Note: this does not seem to matter when using epoll.
@hjr3

This comment has been minimized.

Show comment
Hide comment
@hjr3

hjr3 Sep 15, 2015

Contributor

@carllerche This issue has been fixed in #270 . It looks like this test case triggered the batching behavior that was causing mio to trigger an event for the bad fd. Merge if you want this test case or just close the PR.

Contributor

hjr3 commented Sep 15, 2015

@carllerche This issue has been fixed in #270 . It looks like this test case triggered the batching behavior that was causing mio to trigger an event for the bad fd. Merge if you want this test case or just close the PR.

@hjr3 hjr3 closed this Sep 29, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment