Skip to content
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

Make sure Vertx is closed #290

Merged
merged 2 commits into from
Apr 27, 2023
Merged

Make sure Vertx is closed #290

merged 2 commits into from
Apr 27, 2023

Conversation

dsgrieve
Copy link
Member

@dsgrieve dsgrieve commented Apr 18, 2023

The issue is that the JVM won't exit. Closing Vertx fixes that.

@dsgrieve dsgrieve requested review from a user, johnoliver and milderhc April 18, 2023 18:39
@dsgrieve dsgrieve marked this pull request as ready for review April 18, 2023 19:13

//
// Note well! This cannot be a static final field.
// UnifiedJavaVirtualMachineConfigurationTest hangs if it is.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why?

@@ -23,4 +32,14 @@ protected Vertx vertx() {
return vertx;
}

public void close() {
vertx().close(result -> {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am concerned that this is a race condition in cases where there is more than 1 channel setup. I've not seen Censum not shutdown because of this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run the sample in the gctoolkit repository from the main branch. The app should exit when main exits. It does not. One should not have to explicitly call System.exit().

@dsgrieve dsgrieve merged commit 293e4c7 into main Apr 27, 2023
@dsgrieve dsgrieve deleted the dagrieve/fix-jvm-exit-blocked branch April 27, 2023 21:41
@zheng-kai
Copy link

I would like to know if this issue has been resolved yet. I have downloaded the source code for version 3.0.4 and ran the sample program, but the program still does not end even after the Main function has finished executing.
Here are the results of my execution:

Jun 13, 2023 12:45:51 PM io.netty.util.internal.PlatformDependent <clinit>
INFO: Your platform does not provide complete low-level API for accessing direct buffers reliably. Unless explicitly requested, heap buffer will always be preferred to avoid potential system instability.
Jun 13, 2023 12:45:51 PM io.vertx.core.impl.DeploymentManager
SEVERE: Undeploy failed
java.lang.IllegalStateException: Already undeployed
	at [email protected]/io.vertx.core.impl.DeploymentManager$DeploymentImpl.doUndeploy(DeploymentManager.java:322)
	at [email protected]/io.vertx.core.impl.DeploymentManager.undeployVerticle(DeploymentManager.java:82)
	at [email protected]/io.vertx.core.impl.DeploymentManager.undeployAll(DeploymentManager.java:109)
	at [email protected]/io.vertx.core.impl.VertxImpl.lambda$close$15(VertxImpl.java:629)
	at [email protected]/io.vertx.core.impl.future.FutureImpl$3.onSuccess(FutureImpl.java:141)
	at [email protected]/io.vertx.core.impl.future.FutureBase.emitSuccess(FutureBase.java:60)
	at [email protected]/io.vertx.core.impl.future.FutureImpl.addListener(FutureImpl.java:196)
	at [email protected]/io.vertx.core.impl.future.PromiseImpl.addListener(PromiseImpl.java:23)
	at [email protected]/io.vertx.core.impl.future.FutureImpl.onComplete(FutureImpl.java:164)
	at [email protected]/io.vertx.core.impl.future.PromiseImpl.onComplete(PromiseImpl.java:23)
	at [email protected]/io.vertx.core.impl.VertxImpl.close(VertxImpl.java:628)
	at [email protected]/com.microsoft.gctoolkit.vertx.VertxChannel.close(VertxChannel.java:36)
	at [email protected]/com.microsoft.gctoolkit.vertx.VertxDataSourceChannel.close(VertxDataSourceChannel.java:39)
	at [email protected]/com.microsoft.gctoolkit.jvm.AbstractJavaVirtualMachine.analyze(AbstractJavaVirtualMachine.java:199)
	at [email protected]/com.microsoft.gctoolkit.GCToolKit.analyze(GCToolKit.java:308)
	at Cases/main.Main.main(Main.java:31)

The XYDataSet for G1GCYoungInitialMark contains 10 items.
G1GCYoungInitialMark not managed
The XYDataSet for G1GCRemark contains 10 items.
G1GCRemark not managed
The XYDataSet for G1GCCleanup contains 10 items.
G1GCCleanup not managed
ConcurrentCleanupForNextMark : 10
ConcurrentClearClaimedMarks : 10
ConcurrentMark : 10
ConcurrentRootRegionScan : 10
G1GCYoungInitialMark : 10
G1GCCleanup : 10
G1GCRemark : 10
G1GCConcurrentCleanup : 10
Total pause time  : 0.0243
Total run time    : 0.0243
Percent pause time: 2.84

The version of Java I am using is as follows:

> ./jdk-11.0.19_hotspot/bin/java -version
java version "11.0.19" 2023-04-18 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.19+9-LTS-224)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.19+9-LTS-224, mixed mode)

Is there any solution to this now, or is it a problem with my configuration?

@dsgrieve
Copy link
Member Author

@zheng-kai PR #291 should fix the problem. At least, it works on my machine.

The the IllegalStateException is not a problem (still, I'll create an issue for it).

@kcpeppe
Copy link
Collaborator

kcpeppe commented Jun 13, 2023

Hi @zheng-kai, I believe there should be code in to prevent your app from hanging. I'll take a look to see where that is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants