apache / maven-mvnd

Apache Maven Daemon
https://maven.apache.org/
Apache License 2.0
2.91k stars 207 forks source link

Connection timeout when trying to execute any build #63

Closed galegofer closed 4 years ago

galegofer commented 4 years ago

Hello,

I am getting this error every time I am trying to run a build:

"mvnd clean install"

I am running the software on a VPN, don't know if that may be the issue.

WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[main] INFO org.jboss.fuse.mvnd.common.DaemonRegistry - Removing 0 daemon stop events from registry
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Previous Daemon (df642d73-ad18-43a0-9821-0ad3b45610d1) stopped at 1599465245603 by user or operating system
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Starting a Maven Daemon, 1 stopped Daemon could not be reused, use --status for details
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{uid=9e37e4ec-8243-43e3-9a18-8e33fd9a6de1javaHome=C:\Program Files\Java\jdk1.8.0_251\jre, options=[], mavenHome=C:\apps\mvnd-0.0.4-windows-amd64, pid=35024, address=50141, idleTimeout=10800000, locale=en-US, state=Busy, lastIdle=1599465354751, lastBusy=1599465354751}
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: 9e37e4ec-8243-43e3-9a18-8e33fd9a6de1
  log file: C:\apps\mvnd-0.0.4-windows-amd64\daemon\daemon-9e37e4ec-8243-43e3-9a18-8e33fd9a6de1.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.4-windows-amd64\daemon\daemon-9e37e4ec-8243-43e3-9a18-8e33fd9a6de1.log -----
09:55:54.759 I Daemon started
09:55:54.762 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:302)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:233)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:114)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:188)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:71)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:50141.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:359)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:312)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:299)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:349)
        ... 6 more
marcphilipp commented 4 years ago

Same here.

ppalaga commented 4 years ago

Thanks for the report. I admit this project suffers from a lack of developers working on Windows.

To see whether the issue is caused by your local settings (firewall or similar), could you @marcphilipp or @galegofer please run the integration tests on your machine?

It is basically mvn clean verify -Pnative from the root directory of the source tree. Please check https://github.com/mvndaemon/mvnd#build-mvnd-from-source for prerequisites.

mvn clean verify -Pnative is passing on our Windows CI and I really wonder if it is going to pass on your machines?

marcphilipp commented 4 years ago

For me it fails on macOS.

ppalaga commented 4 years ago

For me it fails on macOS.

Good to know, thanks. Are the integration tests passing on your machine?

ppalaga commented 4 years ago

What is the output of mvnd -v on your machines?

ppalaga commented 4 years ago

It is basically mvn clean verify -Pnative from the root directory of the source tree. Please check https://github.com/mvndaemon/mvnd#build-mvnd-from-source for prerequisites.

BTW, I had to disable sdkman in my ~/bashrc to be able to run the integration tests

galegofer commented 4 years ago

mvnd -v

Sep 16, 2020 2:47:16 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[main] INFO org.jboss.fuse.mvnd.common.DaemonRegistry - Removing 1 daemon stop events from registry
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Starting a Maven Daemon, 2 busy Daemons could not be reused, use --status for details
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{uid=26c457c5-70bc-489b-ba74-300461d684d3javaHome=C:\Program Files\Java\jdk1.8.0_251\jre, options=[], mavenHome=C:\apps\mvnd-0.0.4-windows-amd64, pid=24116, address=63613, idleTimeout=10800000, locale=en-US, state=Busy, lastIdle=1600260438719, lastBusy=1600260438719}
Maven Daemon 0.0.4-windows-amd64 (native)
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: 26c457c5-70bc-489b-ba74-300461d684d3
  log file: C:\apps\mvnd-0.0.4-windows-amd64\daemon\daemon-26c457c5-70bc-489b-ba74-300461d684d3.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.4-windows-amd64\daemon\daemon-26c457c5-70bc-489b-ba74-300461d684d3.log -----
14:47:18.726 I Daemon started
14:47:18.729 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:302)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:233)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:114)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:188)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:71)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:63613.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:359)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:312)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:299)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:349)
        ... 6 more

It looks like it's happening all the time.

I didn't manage yet to run the Integration Tests in my local due to some issues with the artifacts repository that we have in the company, not being able to resolve some Takari lifecycle dependencies.

ppalaga commented 4 years ago

What is your JAVA_VERSION?

BTW, 0.0.5 was released and I guess this issue was not solved by the only included fix?

galegofer commented 4 years ago

java --version

java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b08, mixed mode)

As you said, I am still facing the issue.

λ mvnd -version

Sep 17, 2020 11:52:29 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[main] INFO org.jboss.fuse.mvnd.common.DaemonRegistry - Removing 1 daemon stop events from registry
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Starting a Maven Daemon (subsequent builds will be faster)
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{uid=c5f8742e-08de-420c-b2d9-a34377bbaa04javaHome=C:\Program Files\Java\jdk1.8.0_251, options=[], mavenHome=C:\apps\mvnd-0.0.5-windows-amd64, pid=7996, address=50676, idleTimeout=10800000, locale=en-US, state=Busy, lastIdle=1600336351660, lastBusy=1600336351660}
Maven Daemon 0.0.5-windows-amd64 (native)
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: c5f8742e-08de-420c-b2d9-a34377bbaa04
  log file: C:\apps\mvnd-0.0.5-windows-amd64\daemon\daemon-c5f8742e-08de-420c-b2d9-a34377bbaa04.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.5-windows-amd64\daemon\daemon-c5f8742e-08de-420c-b2d9-a34377bbaa04.log -----
11:52:31.665 I Daemon started
11:52:31.668 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:303)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:233)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:114)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:188)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:71)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:50676.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:360)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:313)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:300)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:350)
        ... 6 more
ppalaga commented 4 years ago

Does the problem still exist with the freshly released mvnd 0.0.6? https://github.com/mvndaemon/mvnd/releases/tag/0.0.6

galegofer commented 4 years ago

Not lucky

λ mvnd -v
Sep 30, 2020 8:55:08 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
[main] INFO org.jboss.fuse.mvnd.common.DaemonRegistry - Removing 0 daemon stop events from registry
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Previous Daemon (fe9c36e5-c453-4680-95e4-3b571e3e58fb) stopped at 1601448881484 by user or operating system
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Previous Daemon (6c5f1cd7-6b4c-48c6-bc98-a13822d800e3) stopped at 1601448902830 by user or operating system
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Starting a Maven Daemon, 2 stopped Daemons could not be reused, use --status for details
[main] INFO org.jboss.fuse.mvnd.client.DaemonConnector - Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{uid=e5acb34d-782b-4206-aa46-5f4b31275780javaHome=C:\Program Files\Java\jdk1.8.0_251, options=[], mavenHome=C:\apps\mvnd-0.0.6-windows-amd64, pid=32692, address=56118, idleTimeout=10800000, locale=en-US, state=Busy, lastIdle=1601448910838, lastBusy=1601448910838}
Maven Daemon 0.0.6-windows-amd64 (native)
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: e5acb34d-782b-4206-aa46-5f4b31275780
  log file: C:\apps\mvnd-0.0.6-windows-amd64\daemon\daemon-e5acb34d-782b-4206-aa46-5f4b31275780.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.6-windows-amd64\daemon\daemon-e5acb34d-782b-4206-aa46-5f4b31275780.log -----
08:55:10.846 I Daemon started
08:55:10.849 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:303)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:233)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:114)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:188)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:71)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:56118.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:360)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:313)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:300)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:350)
        ... 6 more
ppalaga commented 4 years ago

I think something like this may happen if the MVND_HOME env var or mvnd.home property passed to the daemon process does not match what the mvnd client expects. Could you please check the following?

$ echo $MVND_HOME 
/home/ppalaga/.sdkman/candidates/mvnd/current
$ which mvnd
~/.sdkman/candidates/mvnd/current/bin/mvnd
galegofer commented 4 years ago

The variable MVND_HOME seems to don't be set.

λ echo $MVND_HOME

In my case I am not using SDKMAN to use mvnd, I just downloaded the release and unpacked it.

λ which mvnd
/c/apps/mvnd-0.0.6-windows-amd64/bin/mvnd

I don't see the file ~/.m2/mvnd.properties in my user directory.

ppalaga commented 4 years ago

Could you please re-check with the recently released https://github.com/mvndaemon/mvnd/releases/tag/0.0.8 ?

There are two fixes that might help:

marcphilipp commented 4 years ago

Thanks, that fixed it for me on macOS! 👍

ppalaga commented 4 years ago

How about you, @galegofer?

ppalaga commented 4 years ago
λ which mvnd
/c/apps/mvnd-0.0.6-windows-amd64/bin/mvnd

@galegofer /c/apps/... actually does not look like stock Windows. Is this windows subsystem for linux or cygwin?

famod commented 4 years ago

@ppalaga Could also be Git Bash.

ppalaga commented 4 years ago

Windows got so many different flavors since I stopped using it back in 2006. I wonder if they all need to be tested separately?

galegofer commented 4 years ago

No luck yet, I am still getting:

GIT BASH / CMDER

λ mvnd -version
Oct 21, 2020 8:22:48 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Maven Daemon 0.0.8-windows-amd64 (native)
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: 193e38e7-a14e-4c2d-88ec-6668a87faee3
  log file: C:\apps\mvnd-0.0.8-windows-amd64\daemon\daemon-193e38e7-a14e-4c2d-88ec-6668a87faee3.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.8-windows-amd64\daemon\daemon-193e38e7-a14e-4c2d-88ec-6668a87faee3.log -----
08:22:49.847 I Daemon started
08:22:49.849 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:323)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:238)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:119)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:185)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:70)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:58569.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:380)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:333)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:320)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:370)
        ... 6 more

WINDOWS CONSOLE

C:\workspace\test-project>mvnd --version
Oct 21, 2020 8:24:47 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
Maven Daemon 0.0.8-windows-amd64 (native)
Exception in thread "main" org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to the Maven daemon.
Daemon uid: 37ef6dbe-e148-4cd9-9542-77119b8bbe35
  log file: C:\apps\mvnd-0.0.8-windows-amd64\daemon\daemon-37ef6dbe-e148-4cd9-9542-77119b8bbe35.log
----- Last  20 lines from daemon log file - C:\apps\mvnd-0.0.8-windows-amd64\daemon\daemon-37ef6dbe-e148-4cd9-9542-77119b8bbe35.log -----
08:24:50.521 I Daemon started
08:24:50.523 D daemon is running. Sleeping until state changes.----- End of the daemon log -----

        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:323)
        at org.jboss.fuse.mvnd.client.DaemonConnector.startDaemon(DaemonConnector.java:238)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:119)
        at org.jboss.fuse.mvnd.client.DefaultClient.execute(DefaultClient.java:185)
        at org.jboss.fuse.mvnd.client.DefaultClient.main(DefaultClient.java:70)
Caused by: org.jboss.fuse.mvnd.common.DaemonException$ConnectException: Could not connect to server 0.0.0.0/0.0.0.0:58596.
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:380)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemon(DaemonConnector.java:333)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connectToDaemonWithId(DaemonConnector.java:320)
        ... 4 more
Caused by: java.net.SocketTimeoutException
        at sun.nio.ch.SocketAdaptor.connect(SocketAdaptor.java:129)
        at org.jboss.fuse.mvnd.client.DaemonConnector.connect(DaemonConnector.java:370)
        ... 6 more
famod commented 4 years ago

Just checked this on my business laptop (which is using Checkpoint VPN) and it works for me! TBH I would have expected to see the same problem. Anway, it might help if one could tell mvnd to bind to and connect to 127.0.0.1 instead of 0.0.0.0.

famod commented 4 years ago

I was wrong, the second run fails with the same connection timeout! And interestingly, it even fails with disconnected VPN.

ppalaga commented 4 years ago

What is the output of mvnd --status?

And what happens when you issue mvnd --stop and try again?

galegofer commented 4 years ago

I am getting a:

λ mvnd --status
Oct 21, 2020 2:06:06 PM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
                                    UUID      PID   Port   Status  Last activity

Same for Windows CMD.

Running mvnd --stop, doesn't change the above output.

To clarify I am using also Checkpoint VPN, and I am getting this error connected or disconnected as @famod commented. Maybe it possible that Checkpoint VPN is using or blocking somehow port 58596?

famod commented 4 years ago

@galegofer does you machine have other network adapters, e.g. VirtualBox host-only adapters?

galegofer commented 4 years ago

@famod I have ethernet, wifi, "Check point Virtual Network Adapter ..." and "Hyper V Virtual Ethernet Adapter"

famod commented 4 years ago

@galegofer https://github.com/mvndaemon/mvnd/commit/0656e1337ad75982f07df1acf2805a5f4fdce62c fixed it for me. So in case you want to try it out before 0.0.9 is released, you can try the SNAPSHOT: https://github.com/mvndaemon/mvnd/suites/1382179406/artifacts/22751642

galegofer commented 4 years ago

You got it!, good job!

ppalaga commented 4 years ago

Can we close this one then?

galegofer commented 4 years ago

It looks fixed to me, thanks @famod and @ppalaga !

ppalaga commented 4 years ago

Fixed by https://github.com/mvndaemon/mvnd/commit/0656e1337ad75982f07df1acf2805a5f4fdce62c

michael-simons commented 3 years ago

Just for the record, @ppalaga The any local address 0.0.0.0 was the issue on one of my macs as well… Using the loopback works. 👍

ppalaga commented 3 years ago

Thanks for the info. I'd release when I figure out how to integrate the new brew tap into the release pipeline.