10000 Make ScheduleClose() idempotent by ept · Pull Request #445 · eventmachine/eventmachine · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Make ScheduleClose() idempotent #445

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

Merged
merged 1 commit into from
Jun 3, 2013
Merged

Conversation

ept
Copy link
Contributor
@ept ept commented Jun 3, 2013

I think this fixes issue #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 call ScheduleClose() multiple times seems like the cleanest solution to the problem.

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.
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
0