gen_event: eliminate selective-receive in fetch_msg/6 #6199
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Perform a non-selective receive with timeout, and pass the
message to factored-out decode_msg/7, similar to gen_server.
One of our more heavily used
gen_event
servers got into a state of extreme memory consumption and slow processing a couple of times this summer. When I looked into it recently I discovered thatgen_event
's fetch-and-dispatch loop performs a selective receive looking forsystem
andEXIT
messages (without using the ref trick), which could explain the issues.gen_server
always picks the first message, and I strongly believegen_event
should do the same.This bug seems to have been there "for ever" -- even R6B0 has this difference between
gen_event
andgen_server
.