-
Notifications
You must be signed in to change notification settings - Fork 41
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
Code Server's Process Still Running After Stopping the maven launcher ( CTRL + C ) #110
Comments
Same thing when i stop gwt compilation .. the leaf java process ( gwt compiler process ) is still running ... |
I've been a Linux user for years and I don't have any expertise on Windows idiosyncrasies. Patches welcome! |
I have the same problem with the 1.8.2 version of the legacy plugin but the 1.8.1 is ok I will try to fix it. |
It might be due to an update of the plexus-utils dependency (from 3.0.16 to 3.1.0 between org.codehaus.mojo:gwt-maven-plugin 2.8.1 and 2.8.2; and from 3.0.21 to 3.1.0 in net.ltgt.gwt.maven:gwt-maven-plugin 1.0-rc-9 compared to previous versions). You should be able to test with earlier versions of plexus-utils by declaring them in the plugin's dependencies: <plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0-rc-9</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.16</version>
</dependency>
</dependencies>
</plugin> If that fixes it for you, then we'd have at least a lead to explore and possibly report it to plexus-utils (if that doesn't fix it though, it might be that the dependency is not taken into account; run Maven with |
It works fine with the dependency override. There is no a |
Let's keep it open please. You have a workaround, but this still needs fixing (even if that only means waiting for a new version of plexus-utils with a fix and upgrading to it; or temporarily downgrading) |
Easiest solution would be to use jetty's stopPort if possible. If that's not possible, a cross-platform library to kill processes by port number would be in order. (win10/linux: netstat, win10: tasklist+taskkill, linux; kill) Here is a quick and dirty solution I used in one of my projects: But it is mixed with Linux where I simply put an environment variable into the started process and then identify the process using that unique tag. That's not possible under Windows it seems. However, I should note that GWT dev mode does not work too well under Windows anyways because it seems that it sometimes has a race condition where the strict file locking on Windows produces a file access conflict with itself. Maybe it's possible to NOT FORK the codeserver and run it inside the main maven process, at least when using the @default-cli execution? Or attach the forked process' resources to the parent process such that a termination of the parent leads to the termination of the child somehow? |
Adding
allows to shut down a stray codeserver by sending the key to the stop port:
So I recommend setting the stop port by default with a default key value and checking the port connectivity before trying to start the codeserver. Also, on Windows the codeserver is likely to keep locking files in target/ when using CTRL-C. Not sure how to go about this. Probably, there should be a gwt:stop command that is tied to the pre-clean phase by default. |
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4717969 a shutdown hook would at least solve the CTRL-C issue on Windows:
|
There is such a shutdown hook already, with the exception that it calls IOW, what you're proposing is already there. On Windows, a workaround might be to use |
okay, I didn't see that the shutdown hook was already used because the forked plexus-utils repo has a non-working search function. pft. Apart from that, I played around with plexus-utils to find out why my own test case works, but plexus-utils doesn't. Answer: it seems to be related to the stream pumpers. When I replace Runtime.exec() with ProcessBuilder and use its inheritIO() instead, the child process goes away as expected. Specifically using Redirect.INHERIT on the child's STDIN fixes the issue - maybe the child's STDIN FD doesn't get closed the way it's currently handled. Commandline:
|
Patch: #125 |
the build failure is not because of my changes btw |
Update on this issue, because the workaround above no longer works as-is with version 1.0.1 (similar workarounds might work, downgrading both plexus-utils and plexus-io, possibly more dependencies): the bug is upstream in plexus-utils, which is used in many Maven plugins (including Surefire and the maven-compiler-plugin ‼), this is where it needs to be fixed. I'll keep this issue open because indeed it's an issue with the plugin, but I'll only accept PRs that update plexus-utils to a version that fixes the bug. In the mean time, don't use Ctrl+C or similar (killing the Maven task in Eclipse), and rather kill the GWT process itself directly. You could also probably use |
Do you mean |
Oops, yes, |
and without |
with |
So, if you've created a client/server/shared architect, then instead of
Works great, thanks! 👍 |
@tbroyer in case GWT remove the DevMode (as mentioned here: (https://www.gwtproject.org/release-notes.html#Release_Notes_2_11_0), will this have an impact on the work around? |
For the time being, the goal seems to be to eventually default to |
Yes, that makes sense. So, the workaround will also work in the future. I was unsure, if it might fail in the future and a new workaround is needed. |
Note: After a Running the |
Did you configure |
Ah, thank you @tbroyer . Yes, that was the issue. Now with:
And now it still works great after a |
Fwiw, I just published version 2024.2.11 of the gwt-maven-archetypes that adds the |
Hi,
When i launch
mvn gwt:codesever
3 process are started ( maven jvm , cmd and codesever jvm )When I Stop mvn .. the 2 first process are stopped but the codeserver jvm is still running
Regards.
The text was updated successfully, but these errors were encountered: