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

Don't resume fibers directly from event loop callbacks (fixes #8044). #8058

Merged

Conversation

@waj
Copy link
Member

commented Aug 7, 2019

This is required to enable compatibility with libevent 2.1.11, because
a warning is now raised if a fork is executed from within the event loop (libevent/libevent@497ef90).
Since most Crystal code actually runs from within the event loop (from libevent point of view)
the solution is enqueue the fibers and resume them outside the call to event_base_loop.

I tested this patch with samples/http_server and apparently this also contributes with a (totally unexpected) performance improvement (5% to 10%)

Don't resume fibers directly from event loop callbacks (fixes #8044).
This is required to enable compatibility with libevent 2.1.11, because
a warning is now raised if a `fork` is executed from within the event loop (libevent/libevent@497ef90).
Since most Crystal code actually runs from within the event loop (from libevent point of view)
the solution is enqueue the fibers and resume them outside the call to `event_base_loop`.
@jhass

jhass approved these changes Aug 8, 2019

@asterite asterite merged commit 284fb1e into crystal-lang:master Aug 8, 2019

4 of 5 checks passed

ci/circleci: test_linux32 Your tests failed on CircleCI
Details
ci/circleci: check_format Your tests passed on CircleCI!
Details
ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@asterite asterite added this to the 0.31.0 milestone Aug 8, 2019

@bcardiff bcardiff modified the milestones: 0.31.0, 0.30.1 Aug 8, 2019

bcardiff added a commit that referenced this pull request Aug 8, 2019

Don't resume fibers directly from event loop callbacks (fixes #8044). (
…#8058)

This is required to enable compatibility with libevent 2.1.11, because
a warning is now raised if a `fork` is executed from within the event loop (libevent/libevent@497ef90).
Since most Crystal code actually runs from within the event loop (from libevent point of view)
the solution is enqueue the fibers and resume them outside the call to `event_base_loop`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.