UnorderedThreadPoolEventExecutor consumes 100% CPU when idle#6518
Closed
normanmaurer wants to merge 1 commit into
Closed
UnorderedThreadPoolEventExecutor consumes 100% CPU when idle#6518normanmaurer wants to merge 1 commit into
normanmaurer wants to merge 1 commit into
Conversation
Member
Author
|
@Scottmitch PTAL... unfortunally there is really no way for a unit test :( |
Member
|
|
Member
Author
|
@Scottmitch actually I have an idea for a unit test.... stay tuned |
Motivation: When UnorderedThreadPoolEventExecutor.execute / submit etc is called it will consume up to 100 % CPU even after the task was executed. Modifications: Add a special wrapper which we will be used in execute(...) to wrap the submitted Runnable. This is needed as ScheduledThreadPoolExecutor.execute(...) will delegate to submit(...) which will then use decorateTask(...). The problem with this is that decorateTask(...) needs to ensure we only do our own decoration if we not call from execute(...) as otherwise we may end up creating an endless loop because DefaultPromise will call EventExecutor.execute(...) when notify the listeners of the promise. Result: Fixes [#6507].
Scottmitch
approved these changes
Mar 9, 2017
Member
Scottmitch
left a comment
There was a problem hiding this comment.
lgtm ... be nice to avoid the for loop in the test but it should be "good enough"
Member
Author
|
@Scottmitch yeah... could not fine a better solution for the test as without the loop it sometimes passed. |
Member
Author
This was referenced Oct 9, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation:
When UnorderedThreadPoolEventExecutor.execute / submit etc is called it will consume up to 100 % CPU even after the task was executed.
Modifications:
Add a special wrapper which we will be used in execute(...) to wrap the submitted Runnable. This is needed as ScheduledThreadPoolExecutor.execute(...) will delegate to submit(...) which will then use decorateTask(...). The problem with this is that decorateTask(...) needs to ensure we only do our own decoration if we not call from execute(...) as otherwise we may end up creating an endless loop because DefaultPromise will call EventExecutor.execute(...) when notify the listeners of the promise.
Result:
Fixes [#6507].