Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Fix CPU usage when idle #3592

Merged
merged 1 commit into from
Nov 23, 2016
Merged

Fix CPU usage when idle #3592

merged 1 commit into from
Nov 23, 2016

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Nov 23, 2016

mio sometimes enter some weird state where it keeps hammering the timer loop with the following trace (Note that target_tick < current_tick):

2016-11-23 18:34:28   TRACE mio::timer  wakeup thread: sleep_until_tick=425; now_tick=426
2016-11-23 18:34:28   TRACE mio::timer  setting readiness from wakeup thread
2016-11-23 18:34:28   TRACE mio::poll  set_readiness event Ready {Readable} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::poll  returning readiness event Ready {Readable} Token(18446744073709551614)
2016-11-23 18:34:28   TRACE mio::timer  wakeup thread: sleep_until_tick=18446744073709551615; now_tick=426
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  io_process(..); cnt=1; len=1
2016-11-23 18:34:28   TRACE mio::timer  sleeping; tick_ms=100; now_tick=426; blocking sleep
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event=Event { kind: Ready {Readable}, token: Token(18446744073709551614) }; idx=0
2016-11-23 18:34:28   TRACE mio::poll  registering with poller
2016-11-23 18:34:28   TRACE mio::sys::unix::kqueue  registering; token=Token(1); interests=Ready {Readable | Writable | Hup}
2016-11-23 18:34:28   TRACE mio::poll  set_readiness event Ready {} Token(18446744073709551614)
2016-11-23 18:34:28   TRACE mio::poll  registering with poller
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event loop tick
2016-11-23 18:34:28   TRACE mio::poll  custom readiness queue has pending events
2016-11-23 18:34:28   TRACE mio::poll  returning readiness event Ready {Readable} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  io_process(..); cnt=1; len=1
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event=Event { kind: Ready {Readable}, token: Token(18446744073709551613) }; idx=0
2016-11-23 18:34:28   TRACE mio::timer  tick_to; target_tick=426; current_tick=427
2016-11-23 18:34:28   TRACE mio::timer  unsetting readiness
2016-11-23 18:34:28   TRACE mio::poll  set_readiness event Ready {} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::timer  advancing the wakeup time; target=425; curr=18446744073709551615
2016-11-23 18:34:28   TRACE mio::timer  unparking wakeup thread
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event loop tick
2016-11-23 18:34:28   TRACE mio::timer  wakeup thread: sleep_until_tick=425; now_tick=426
2016-11-23 18:34:28   TRACE mio::timer  setting readiness from wakeup thread
2016-11-23 18:34:28   TRACE mio::poll  set_readiness event Ready {Readable} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::timer  wakeup thread: sleep_until_tick=18446744073709551615; now_tick=426
2016-11-23 18:34:28   TRACE mio::timer  sleeping; tick_ms=100; now_tick=426; blocking sleep
2016-11-23 18:34:28   TRACE mio::poll  returning readiness event Ready {Readable} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  io_process(..); cnt=1; len=1
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event=Event { kind: Ready {Readable}, token: Token(18446744073709551613) }; idx=0
2016-11-23 18:34:28   TRACE mio::timer  tick_to; target_tick=426; current_tick=427
2016-11-23 18:34:28   TRACE mio::timer  unsetting readiness
2016-11-23 18:34:28   TRACE mio::poll  set_readiness event Ready {} Token(18446744073709551613)
2016-11-23 18:34:28   TRACE mio::timer  advancing the wakeup time; target=425; curr=18446744073709551615
2016-11-23 18:34:28   TRACE mio::timer  unparking wakeup thread
2016-11-23 18:34:28   TRACE mio::deprecated::event_loop  event loop tick
2016-11-23 18:34:28   TRACE mio::timer  wakeup thread: sleep_until_tick=425; now_tick=426
2016-11-23 18:34:28   TRACE mio::timer  setting readiness from wakeup thread

My patch for this:
paritytech/mio@ef182ba

@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. M4-core ⛓ Core client code / Rust. B0-patch labels Nov 23, 2016
@gavofyork gavofyork added A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). and removed A0-pleasereview 🤓 Pull request needs code review. labels Nov 23, 2016
@gavofyork gavofyork merged commit 34ab265 into master Nov 23, 2016
@gavofyork gavofyork deleted the mio-cpu-fix branch November 23, 2016 18:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants