vert.x
vert.x copied to clipboard
Redeploy doesn't work on Windows 10
Version
vertx: 3.9.4 and 3.8.5
Context
On linux everything works fine. On Windows 10 redeploy doesn't work. When changing the code it appears on terminal that the app is getting rebuilt and redeployed, however the changes aren't applied and the app that running is still the same as the initial. Also, after pressing ctrl+c the app isn't terminated, but it keeps on running on background and you have to kill it by command or task manager in order to stop it.
Do you have a reproducer?
Problem appears on my projects but it is also reproducible with a starter project.
Steps to reproduce
Redeploy not working:
- Use Windows 10
- Create a starter project with gradle at https://start.vertx.io/
- Run from powershell
.\gradlew.bat run - Open url
localhost:8888to check message - Change message and see from the terminal that it seems to be re deploying the app
- Refresh web browser and see that message didn't change.
Ctrl+c doesn't terminate app:
7. Press ctrl+c on terminal to exit the app
8. Refresh web browser and see that app still running
9. Run from powershell .\gradlew.bat run again and see error "java.net.BindException: Address already in use: bind" because app is arleady running.
Extra
gradle: 6.7 and 6.6.1 openjdk: 11 and 15 OS: windows 10
vertx: 3.9.4 and 3.8.5
Have you tried with vertx 4 ?
Le sam. 31 oct. 2020 à 15:52, Thanos Apostolou [email protected] a écrit :
Version
vertx: 3.9.4 and 3.8.5 Context
On linux everything works fine. On Windows 10 redeploy doesn't work. When changing the code it appears on terminal that the app is getting rebuilt and redeployed, however the changes aren't applied and the app that running is still the same as the initial. Also, after pressing ctrl+c the app isn't terminated, but it keeps on running on background and you have to kill it by command or task manager in order to stop it. Do you have a reproducer?
Problem appears on my projects but it is also reproducible with a starter project. Steps to reproduce
Redeploy not working:
- Use Windows 10
- Create a starter project with gradle at https://start.vertx.io/
- Run from powershell .\gradlew.bat run
- Open url localhost:8888 to check message
- Change message and see from the terminal that it seems to be re deploying the app
- Refresh web browser and see that message didn't change.
Ctrl+c doesn't terminate app: 7. Press ctrl+c on terminal to exit the app 8. Refresh web browser and see that app still running 8. Run from powershell .\gradlew.bat run again and see error "java.net.BindException: Address already in use: bind" because app is arleady running. Extra
gradle: 6.7 and 6.6.1 openjdk: 11 and 15 OS: windows 10
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eclipse-vertx/vert.x/issues/3623, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALOLNUZSOACC7DY7OAU5CTSNQQCRANCNFSM4TF5XX2Q .
Just tried it and I see the exact same problem.
Ok, thanks for reporting this!
@ThanosApostolou I could take some time to look into this and there are two problems actually.
1/ the doOnChange value is incorrect, it should not start with a dot
It should be gradlew classes instead of ./gradlew classes
See https://github.com/vert-x3/vertx-starter/blob/master/src/main/resources/templates/build.gradle.kts.ftl#L43
Because of this the application is not recompiled and that's why you can't see any change.
I will update the starter template to address the problem.
2/ There's an issue with Gradle that kills the Vert.x process that watches for changes without giving it a chance to stop the Vert.x process that runs the application.
For this I'm not sure what I can do.
Any idea @jponge ?
shall we close this issue @tsegismont ?
I think we should keep it open, remove the target milestone and add the help wanted label.
This is something specific to Gradle on Windows, I have no time to investigate it.
Hi, this is still an issue. As I understand it the --redeploy option will cause a forked process to be launched. gradle only terminates the parent process in Windows.
As a degraded workaround, I removed the --redeploy option from the gradle build file and relaunch manually
It seems there is a gradle PR that may address this problem (killing the process tree rather than the parent process), so hopefully this will be solved soon: https://github.com/gradle/gradle/pull/18756
Tested the issue using the latest version pulled from https://start.vertx.io/ (4.4.2) and on Windows 10 (and 11) this issue is no longer a thing. Hot reloading works fine.
As for the gradle issue, there a few things I have found from my short investigation:
CTRL+c does not kill the Java process. This is because CTRL+c on Windows sends an interupt signal to the Gradle command and not the child processes (hence why the OP is seeing the BindException, because children are not killed). On Linux (and like systems), it's a SIGINT which would usually close the child processes. However, the issue freynder has referenced should hope to fix this in a future Gradle release.
I suspect, if we did a fix in Vert.x, we could implement a shutdown hook in the Vert.x startup process to listen for SIGINT/CTRL+c and clean itself up. This would most likely require some low-level programming but it wouild be a good addition to Vert.x. But on a more realistic note, it's really not Vert.x's problem but a Gradle one.
My suggestion would be to abandon this. In a production environment, nobody would be doing gradle run (at least we would hope).