-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Ensure that the task is not in the tasks queue when it is rejected from the executor #4901
Ensure that the task is not in the tasks queue when it is rejected from the executor #4901
Conversation
09e8e66
to
e625617
Compare
Updated the PR to ensure proper encapsulation in |
e625617
to
1ecd3bf
Compare
can you elaborate when/how this happens ? if a task is rejected it usually means that vertx is closed, unless I am wrong ? |
For me, Vert.x is used as part of Quarkus, which is then the base of Keycloak. At the moment I'm running some load tests around Keycloak, and I want to have a first naive load shedding in place. In a Keycloak setup, Quarkus replaces the executor pool of Vert.x with its own thread pool. I can ask Quarkus to limit the backlog of the executor thread pool using a configuration I'm discussing more elaborate means of load shedding and not relying on the thread pool queue site. Until that is in place, this is all I have. I hope this adds the context the issue is missing. |
thanks for the context |
@@ -125,19 +125,30 @@ public Consumer<Runnable> unschedule() { | |||
*/ | |||
public void execute(Runnable task, Executor executor) { | |||
synchronized (tasks) { | |||
tasks.add(new ExecuteTask(task, executor)); | |||
ExecuteTask executeTask = new ExecuteTask(task, executor); | |||
tasks.add(executeTask); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think instead since we are in a synchronized block, we could move this addition to the bottom of the block after we are sure the executor accepted the task instead of adding/removing it
1ecd3bf
to
7b3a47c
Compare
…om the executor Closes eclipse-vertx#4900
7b3a47c
to
2d74868
Compare
@vietj - thank you for the review. I've moved the statement, and also added a comment to state why this is the right place. Please give it another review when you have the time. |
thanks for the contribution, do you mind porting this to the 4.x branch ? |
Closes #4900
Motivation:
This is a PR to address #4900. It is rather crude, and uses package visibility. While this does the job to make the assertions, I'd be happy to receive advice on how to change it to match the Vert.x's project way.
Conformance:
You should have signed the Eclipse Contributor Agreement as explained in https://github.com/eclipse/vert.x/blob/master/CONTRIBUTING.md