-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Vert.x TCCL fixes #19487
Vert.x TCCL fixes #19487
Conversation
d03e549
to
1d68df5
Compare
if (launchMode == LaunchMode.DEVELOPMENT) { | ||
devModeThreads.add(thread); | ||
} | ||
return VertxThreadFactory.super.newVertxThread(target, name, worker, maxExecTime, maxExecTimeUnit); |
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 suppose you meant to return the existing thread
instance?
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 mean, rather than invoking the factory once more.
EnhancedQueueExecutor executor = (EnhancedQueueExecutor) result; | ||
final Thread[] runningThreads = executor.getRunningThreads(); | ||
for (Thread t : runningThreads) { | ||
for (var t : devModeThreads) { |
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.
Awesome 👍
@@ -383,7 +383,7 @@ private RunTimeConfigurationGenerator() { | |||
cc.getFieldCreator(C_BUILD_TIME_CONFIG_SOURCE) | |||
.setModifiers(Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_FINAL); | |||
final ResultHandle buildTimeConfigSource = clinit.newInstance(PCS_NEW, buildTimeValues, | |||
clinit.load("Build time config"), clinit.load(100)); | |||
clinit.load("Build time config"), clinit.load(Integer.MAX_VALUE)); |
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.
How is this related?
...loyment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java
Outdated
Show resolved
Hide resolved
d3052a3
to
4a87bb2
Compare
FTR, I confirm that this is fixing that nasty problem we were fighting with the last few days: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/main.3A.20NPE.20in.20SR.20Config.20ClassPathUtils/near/249911993 Thanks @stuartwdouglas, master of threads, contexts and loaders! 😁 |
there's a potential race condition between expansion of the threadpool and the context being swapped: not a blocker for the current excellent PR, but we should follow up on that. Also considering some machines might want to start lots of threads, I'd replace the "copy on write set" with a regular set , as we get rid of the race with a lock. |
14a2def
to
e381f0f
Compare
@Sanne race should be gone now, and it is also a lot more careful not to capture the original TCCL and cause a leak in dev mode. |
e381f0f
to
8ed92ed
Compare
@@ -230,6 +176,10 @@ public void handle(AsyncResult<Void> event) { | |||
} catch (InterruptedException e) { | |||
throw new RuntimeException(e); | |||
} | |||
synchronized (devModeThreads) { |
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.
Hello Stuart, is there a chance that the threads and classloader will leak if the previous try block throws an exception? In other words, should we use a finally
block here to clear the collection and the classloader?
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.
In theory this could happen, I will change it.
8ed92ed
to
e761880
Compare
This workflow status is outdated as a new workflow run has been triggered. Failing Jobs - Building e761880
Full information is available in the Build summary check run. Test Failures⚙️ MicroProfile TCKs Tests #📦 tcks/microprofile-fault-tolerance✖
|
@@ -253,9 +204,34 @@ public static Vertx initialize(VertxConfiguration conf, VertxOptionsCustomizer c | |||
|
|||
Vertx vertx; | |||
|
|||
Optional<ClassLoader> nonDevModeTccl; |
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.
This whole block looks very similar to createThreadFactory()
, no?
IMO, the complexity warrants a single method that can be used in both cases, but YMMV!
...nsions/vertx-core/runtime/src/main/java/io/quarkus/vertx/core/runtime/VertxCoreRecorder.java
Outdated
Show resolved
Hide resolved
e761880
to
8d4a650
Compare
Failing Jobs - Building 8d4a650
Full information is available in the Build summary check run. Test Failures⚙️ Gradle Tests - JDK 11 Windows #📦 integration-tests/gradle✖
|
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.
LGTM and it still fixes the problem I was seeing. 🤓
I briefly tested a few other things with my current app (e.g. dev mode reload) and it's all looking good so far. |
No description provided.