8000 Make ScheduleClose() idempotent by ept · Pull Request #18 · ibc/EventMachine-LE · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Make ScheduleClose() idempotent #18

Merged
merged 1 commit into from
Oct 7, 2013
Merged

Make ScheduleClose() idempotent #18

merged 1 commit into from
Oct 7, 2013

Conversation

ept
Copy link
@ept ept commented Jun 3, 2013

See eventmachine#445. This fixes an issue that causes the EM reactor to spin in a tight loop, using 100% of one CPU core.

I think this fixes issue eventmachine#441.

8b613d0 changed the `select` timeout to zero in the case where
NumCloseScheduled > 0. It seems that in certain circumstances (for
example, if `close_connection` is called in a connection's `unbind`)
NumCloseScheduled would get incremented twice, but only decremented
once, thus never again reaching zero for the lifetime of the reactor.

The user-observed effect was that one CPU core would be pegged at 100%,
because the zero `select` timeout caused us to go around the select loop
without any pause.

Changing it so that it is safe to ScheduleClose() multiple times seems
like the cleanest solution to the problem.
ibc added a commit that referenced this pull request Oct 7, 2013
Make ScheduleClose() idempotent
@ibc ibc merged commit 74f7d38 into ibc:master Oct 7, 2013
@ept
Copy link
Author
ept commented Oct 7, 2013

Thanks for merging!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0