quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.54k stars 2.61k forks source link

Maven tests failing on Windows with remote dev waiting for input #31576

Open gsmet opened 1 year ago

gsmet commented 1 year ago

I have seen the Maven tests failing a lot on Windows lately with the following pattern:

 [INFO] --- quarkus-maven-plugin:999-SNAPSHOT:remote-dev (default-cli) @ acme ---
[INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources @ acme
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\a\quarkus\quarkus\integration-tests\maven\target\test-classes\projects\project-classic-run-java-change-local\src\test\resources
[INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile @ acme
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to D:\a\quarkus\quarkus\integration-tests\maven\target\test-classes\projects\project-classic-run-java-change-local\target\test-classes
Listening for transport dt_socket at address: 5005
2023-03-02 15:10:52,178 INFO  [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation completed in 1876ms
2023-03-02 15:10:53,094 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending lib/deployment/appmodel.dat
2023-03-02 15:10:53,113 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending app/acme-1.0-SNAPSHOT.jar
2023-03-02 15:10:53,118 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending quarkus-run.jar
2023-03-02 15:10:53,122 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Connected to remote server
2023-03-02 15:10:55,693 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (Remote dev client thread) Restarting quarkus due to changes in HelloResource.class, HelloResource$Blah.class.
2023-03-02 15:10:56,250 INFO  [io.qua.dep.QuarkusAugmentor] (Remote dev client thread) Quarkus augmentation completed in 556ms
2023-03-02 15:10:56,257 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (Remote dev client thread) Live reload total time: 1.116s 
2023-03-02 15:10:56,633 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending app/acme-1.0-SNAPSHOT.jar
2023-03-02 15:10:56,638 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending quarkus-run.jar
2023-03-02 15:10:56,643 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending dev/app/org/acme/HelloResource.class
Terminate batch job (Y/N)? 
Error: The operation was canceled.

I think remove dev is somehow waiting for input indefinitely until the job is cancelled by GitHub Actions.

There are other errors before but I'm not sure if they are related:

2023-03-02 15:10:18,297 INFO  [io.qua.dep.dev.RuntimeUpdatesProcessor] (Remote dev client thread) Live reload total time: 3.137s 
Error:  Port 5005 in use, not starting in debug mode
Debugger failed to attach: handshake failed - connection prematurally closed
2023-03-02 15:10:19,114 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending app/acme-1.0-SNAPSHOT.jar
2023-03-02 15:10:19,120 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending quarkus-run.jar
2023-03-02 15:10:19,125 INFO  [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Sending dev/app/application.properties
2023-03-02 15:10:20,756 ERROR [io.qua.ver.htt.dep.dev.HttpRemoteDevClient] (Remote dev client thread) Remote dev request failed: java.net.SocketException: Connection reset
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:186)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at java.base/java.io.BufferedInputStream.fill(BufferedInputStream.java:252)
    at java.base/java.io.BufferedInputStream.read1(BufferedInputStream.java:292)
    at java.base/java.io.BufferedInputStream.read(BufferedInputStream.java:351)
    at java.base/sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:787)
    at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:722)
    at java.base/sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:746)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1615)
    at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
    at io.quarkus.vertx.http.deployment.devmode.HttpRemoteDevClient$Session.run(HttpRemoteDevClient.java:222)
    at java.base/java.lang.Thread.run(Thread.java:829)

An example of failing run is here: https://github.com/quarkusio/quarkus/actions/runs/4314124744/jobs/7527940195 but there are a lot of others.

quarkus-bot[bot] commented 1 year ago

/cc @quarkusio/devtools (maven)

Karm commented 1 year ago

@gsmet The thing is that it might not be easily possible to send something to a detached terminal on Windows. E.g. to send Ctrl+C did not work for me, the launched process had a detached terminal, so writing Ctrl+C to input stream did nothing.

I ended up doing this: https://github.com/Karm/mandrel-integration-tests/blob/master/testsuite/src/it/resources/CtrlC.cpp

And I execute it with a Quarkus' process PID as an argument to send Ctrl+C to it.

Maybe something similar is in order here too....