-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix timing of thread pool shutdown to respect quarkus.thread-pool.shutdown-interrupt config property #49921
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
Conversation
gsmet
left a comment
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 haven’t checked the logic but I find that the new variable names add to the confusion as I don’t find them very consistent.
I think we should name the ones coming from the config (after conversion to nanos): configuredShutdownMaxDelay and configuredInterruptMaxDelay (or something similar).
And have consistent naming for shutdown and interrupt when the two variables mean the same thing.
Does it make sense? I’m on my phone so it might not :)
|
Oh and thanks a lot for having a look and creating a PR :) |
5623f85 to
5d2d863
Compare
|
Changed to use more meaningful variable names. It seems to me that there's still a bug: if I don't specify
|
Status for workflow
|
|
@dmlloyd from what I can see, you implemented this config so I marked you as reviewer. |
|
Unless I misunderstand something, I think the bug (which I introduced) is that we're not updating diff --git core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
index cc275c5ceac..53bc49893a6 100644
--- core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
+++ core/runtime/src/main/java/io/quarkus/runtime/ExecutorRecorder.java
@@ -92,7 +92,7 @@ public void run() {
intervalRemaining, interruptRemaining);
try {
if (!executor.awaitTermination(Math.min(remaining, intervalRemaining), TimeUnit.NANOSECONDS)) {
- long elapsed = System.nanoTime() - start;
+ long elapsed = -start + (start = System.nanoTime());
intervalRemaining -= elapsed;
remaining -= elapsed;
interruptRemaining -= elapsed; |
|
@dmlloyd I personally wouldn't go with such a cryptic syntax. Especially given we already missed a regression in there. While more verbose, I think the new code is probably a bit clearer. But not my area so I will let you judge. That being said, I think we need a fix merged. |
|
Sure, if it's too cryptic it can be simplified by introducing a temporary variable to represent the intermediate value: long finished = System.nanoTime();
elapsed = finished - start;
start = finished;But either way the fix should be no more than a few lines. I suggest it because I think the proposed change is quite confusing due to the variable renames obscuring the meanings of the values. |
Closes quarkusio#49921. Fixes quarkusio#49973.
Closes quarkusio#49921. Fixes quarkusio#49973.
|
I opened #50423 due to lack of response on this PR. |
Closes quarkusio#49921. Fixes quarkusio#49973. (cherry picked from commit afe8a93)
Closes quarkusio#49921. Fixes quarkusio#49973. (cherry picked from commit afe8a93)
Closes quarkusio#49921. Fixes quarkusio#49973. (cherry picked from commit afe8a93)
quarkus.thread-pool.shutdown-interruptis not respected #49733