-
Notifications
You must be signed in to change notification settings - Fork 164
Report more detail in VM start errors #398
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
This is a nice improvement. Currently the CI reports some checkstyle errors, you can run checkstyle check via cmd
|
009ead8
to
2535217
Compare
@testforstephen thank you. Just a few checkstyle errors there! I've force-pushed a fix for them to keep the commit history clean. I have been investigating terminating early if the process exits... I don't know if there are any clever tricks to do that here, I haven't done any work with |
Lines 86 to 95 in e6655ea
How about using process.onExit().whenCompleteAsync((p, ex) -> {
if (vm == null) { // When the debug connection is not set up yet.
listenConnector.stopListening(args);
...
}
}); |
fe233f1
to
4ca695a
Compare
@testforstephen I have pushed some additional work that detects early termination of the launched process, so we no longer have to wait for the timeout to report the error. |
Just came back from vacation, I will find some time this week to review this PR? BTW, do you have any sample project to help reproduce the issue at #397? thanks. |
final CompletableFuture<VirtualMachineImpl> result = new CompletableFuture<>(); | ||
|
||
/* Listen for the debug connection from the Java process */ | ||
ForkJoinPool.commonPool().execute(() -> { |
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.
Prefer to use CompletableFuture.runAsync(...)
}); | ||
|
||
/* Wait for the Java process to exit; if it exits before the debug connection is made, report it as an error. */ | ||
process.onExit().thenAcceptAsync(theProcess -> { |
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 real world, is there any use case that the process has exited but the listenConnector is still keeping the connection and not terminate?
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.
@testforstephen I'm not sure. I have seen socket-related things not detecting disconnection etc. I tried to tidy everything up in each case. Is there a particular case that you're thinking may be overkill?
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 see process.onExit() is hit immediately with your sample. Looks good.
@testforstephen I hope you had a great vacation. I have added a very simple example of reproducing the error to #397. |
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. @karlvr thanks for the contribution.
Resolves #397 or at least contributes to it