Skip to content

gradle an existing connection was forcibly closed by the remote host #14094

Closed
@Drezir

Description

@Drezir

Hi, I am suddenly starting to get this error. I can reproduce it even on newly created project using start.spring.io.

What I have already tried:

  • deleting $USER_HOME/.gradle directory
  • deleting project .gradle directory
  • I have downgraded from 6.5.1 do 6.4 and that works.
  • Version 6.6 also affected
  • Version 6.4.1 does not work

Only highlighted changes I have:

java {
    withSourcesJar()
}
C:\Users\aostrozlik\Desktop\core>gradlew -S
Starting a Gradle Daemon, 30 stopped Daemons could not be reused, use --status for details

FAILURE: Build failed with an exception.

* What went wrong:
Could not receive a message from the daemon.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.launcher.daemon.client.DaemonConnectionException: Could not receive a message from the daemon.
        at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:83)
        at org.gradle.launcher.daemon.client.DaemonClient.executeBuild(DaemonClient.java:168)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:148)
        at org.gradle.launcher.daemon.client.DaemonClient.execute(DaemonClient.java:99)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:56)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:212)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:294)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$ParseAndBuildAction.execute(DefaultCommandLineActionFactory.java:266)
        at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:82)
        at org.gradle.launcher.cli.DebugLoggerWarningAction.execute(DebugLoggerWarningAction.java:30)
        at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:92)
        at org.gradle.launcher.cli.WelcomeMessageAction.execute(WelcomeMessageAction.java:38)
        at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:44)
        at org.gradle.launcher.cli.NativeServicesInitializingAction.execute(NativeServicesInitializingAction.java:26)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:41)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:26)
        at org.gradle.launcher.cli.DefaultCommandLineActionFactory$WithLogging.execute(DefaultCommandLineActionFactory.java:259)
        at org.gradle.launcher.Main.doAction(Main.java:35)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:50)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:60)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:37)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:31)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:35)
        at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:108)
        at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:63)
Caused by: org.gradle.internal.remote.internal.MessageIOException: Could not read message from '/127.0.0.1:10627'.
        at org.gradle.internal.remote.internal.inet.SocketConnection.receive(SocketConnection.java:94)
        at org.gradle.launcher.daemon.client.DaemonClientConnection.receive(DaemonClientConnection.java:77)
        ... 32 more
Caused by: com.esotericsoftware.kryo.KryoException: java.io.IOException: Software v hostitelskÚm poŔÝtaŔi ukonŔil vytvo°enÚ p°ipojenÝ
        at com.esotericsoftware.kryo.io.Input.fill(Input.java:148)
        at com.esotericsoftware.kryo.io.Input.require(Input.java:178)
        at com.esotericsoftware.kryo.io.Input.readVarInt(Input.java:355)
        at com.esotericsoftware.kryo.io.Input.readInt(Input.java:350)
        at org.gradle.internal.serialize.kryo.KryoBackedDecoder.readSmallInt(KryoBackedDecoder.java:127)
        at org.gradle.internal.serialize.DefaultSerializerRegistry$TaggedTypeSerializer.read(DefaultSerializerRegistry.java:142)
        at org.gradle.internal.serialize.Serializers$StatefulSerializerAdapter$1.read(Serializers.java:36)
        at org.gradle.internal.remote.internal.inet.SocketConnection.receive(SocketConnection.java:81)
        ... 33 more
Caused by: java.io.IOException: Software v hostitelskÚm poŔÝtaŔi ukonŔil vytvo°enÚ p°ipojenÝ
        at java.base/sun.nio.ch.SocketDispatcher.read0(Native Method)
        at java.base/sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:46)
        at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:233)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
        at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:367)
        at org.gradle.internal.remote.internal.inet.SocketConnection$SocketInputStream.read(SocketConnection.java:196)
        at com.esotericsoftware.kryo.io.Input.fill(Input.java:146)
        ... 40 more

Gradle status

  PID STATUS   INFO
  8448 STOPPED  (after the daemon was no longer found in the daemon registry)
 21340 STOPPED  (after the daemon was no longer found in the daemon registry)
 21196 STOPPED  (after the daemon was no longer found in the daemon registry)
 13864 STOPPED  (after the daemon was no longer found in the daemon registry)
 13000 STOPPED  (after the daemon was no longer found in the daemon registry)
 11436 STOPPED  (after the daemon was no longer found in the daemon registry)
 16004 STOPPED  (after the daemon was no longer found in the daemon registry)
   100 STOPPED  (after the daemon was no longer found in the daemon registry)
 20892 STOPPED  (after the daemon was no longer found in the daemon registry)
  9040 STOPPED  (after the daemon was no longer found in the daemon registry)
  7040 STOPPED  (after the daemon was no longer found in the daemon registry)
 19132 STOPPED  (after the daemon was no longer found in the daemon registry)
 15952 STOPPED  (after the daemon was no longer found in the daemon registry)
  9212 STOPPED  (after the daemon was no longer found in the daemon registry)
  8048 STOPPED  (after the daemon was no longer found in the daemon registry)
 16924 STOPPED  (after the daemon was no longer found in the daemon registry)
  1772 STOPPED  (after the daemon was no longer found in the daemon registry)
  1908 STOPPED  (after the daemon was no longer found in the daemon registry)
 17888 STOPPED  (after the daemon was no longer found in the daemon registry)
 11312 STOPPED  (after the daemon was no longer found in the daemon registry)
 16276 STOPPED  (after the daemon was no longer found in the daemon registry)
 16848 STOPPED  (after the daemon was no longer found in the daemon registry)
 17204 STOPPED  (after the daemon was no longer found in the daemon registry)
 13616 STOPPED  (after the daemon was no longer found in the daemon registry)
 15436 STOPPED  (after the daemon was no longer found in the daemon registry)
 11152 STOPPED  (after the daemon was no longer found in the daemon registry)
  9220 STOPPED  (after the daemon was no longer found in the daemon registry)
 17944 STOPPED  (after the daemon was no longer found in the daemon registry)
  9520 STOPPED  (by user or operating system)

Gradle info:

Starting a Gradle Daemon, 29 stopped Daemons could not be reused, use --status for details
Starting process 'Gradle build daemon'. Working directory: C:\Users\aostrozlik\.gradle\daemon\6.5.1 Command: C:\Program Files\AdoptOpenJDK\jdk-14.0.2.12-hotspot\bin\java.exe --add-opens java.base/java.util=ALL-UNNAMED --add-opens ja
va.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=windows-
1250 -Duser.country=CZ -Duser.language=cs -Duser.variant -cp C:\Users\aostrozlik\.gradle\wrapper\dists\gradle-6.5.1-bin\1m5048aptkfynhbvolwgr4ej9\gradle-6.5.1\lib\gradle-launcher-6.5.1.jar org.gradle.launcher.daemon.bootstrap.Gradle
Daemon 6.5.1
Successfully started process 'Gradle build daemon'
An attempt to start the daemon took 1.953 secs.
Removing daemon from the registry due to communication failure. Daemon information: DaemonInfo{pid=10176, address=[db41e774-f36e-45b6-a030-8c68a1a842bf port:10605, addresses:[/127.0.0.1]], state=Busy, lastBusy=1597141329670, context
=DefaultDaemonContext[uid=7c12bead-ca8c-4a3d-a1be-71e4574df391,javaHome=C:\Program Files\AdoptOpenJDK\jdk-14.0.2.12-hotspot,daemonRegistryDir=C:\Users\aostrozlik\.gradle\daemon,pid=10176,idleTimeout=10800000,priority=NORMAL,daemonOp
ts=--add-opens,java.base/java.util=ALL-UNNAMED,--add-opens,java.base/java.lang=ALL-UNNAMED,--add-opens,java.base/java.lang.invoke=ALL-UNNAMED,--add-opens,java.prefs/java.util.prefs=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDump
OnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=windows-1250,-Duser.country=CZ,-Duser.language=cs,-Duser.variant]}

Activity

big-guy

big-guy commented on Aug 12, 2020

@big-guy
Member

Could you run with --debug and send me the build log to sterling@gradle.com with 6.4 and 6.6?

Camork

Camork commented on Sep 8, 2020

@Camork

I got into the same issue, I have to reboot to resolve it, but it will come soon.

hborchardt

hborchardt commented on Sep 29, 2020

@hborchardt

I got this issue and solved it by deactivating the Windows 10 mobile hotspot internet sharing. I then reproduced it by activating the hotspot and connecting a device to it, and starting ./gradlew -S --no-daemon to spawn a new daemon, which produced the error again.

kriegaex

kriegaex commented on Oct 9, 2020

@kriegaex

OMG, Windows 10 mobile hotspot! Thank you so much! I could not start a single Gradle build for months, neither with or without daemon, because I always activate the hotspot. As soon as I deactivate the mobile hotspot, it works.

Please fix this issue ASAP, it must be a networking issue.

kriegaex

kriegaex commented on Oct 9, 2020

@kriegaex

Trusting @Drezir and his original problem report, it used to work in Gradle 6.4 and started failing in 6.4.1. I have not checked in order to confirm that. I have just checked and can confirm it. Hence, the problem should be somewhere in this diff: v6.4.0...v6.4.1

Maybe one of the maintainers wants to check the diff, it is not very big, only 11 commits. This change seems to be network-related, for instance. It is from commit 490d43b.

hborchardt

hborchardt commented on Oct 14, 2020

@hborchardt

I investigated a little more and it appears that after connecting a device to the mobile hotspot, even a ping 127.0.0.1 on the console does not work for me. This is very strange behaviour on Microsoft's part, and very likely the reason for this bug, as @kriegaex pointed out a commit with the addition of a check if the loopback interface address is reachable. Accessing services started on 127.0.0.1 is possible though (e.g. curl http://127.0.0.1 works).
I wasn't able to find any resources on this behaviour, or even how the hotspot feature exactly works.

Maybe @big-guy can figure out an alternative to the reachability check, as I don't fully understand why it was added :)

kriegaex

kriegaex commented on Oct 15, 2020

@kriegaex

after connecting a device to the mobile hotspot, even a ping 127.0.0.1 on the console does not work for me.

Confirmed.

Accessing services started on 127.0.0.1 is possible though (e.g. curl http://127.0.0.1 works).

Confirmed.

I wasn't able to find any resources on this behaviour, or even how the hotspot feature exactly works.

I did not investigate, but maybe the output of route print helps (in German, sorry). I hope it is not information overkill for a simple problem:

===========================================================================
Schnittstellenliste
 11...8c 16 45 1f 66 b4 ......Intel(R) Ethernet Connection (4) I219-V
 28...00 28 f8 57 0c 70 ......Microsoft Wi-Fi Direct Virtual Adapter #2
 22...00 ff a4 0d f7 3a ......TAP-Windows Adapter V9
  8...00 28 f8 57 0c 6f ......Intel(R) Dual Band Wireless-AC 8265
 34...02 28 f8 57 0c 6f ......Microsoft Wi-Fi Direct Virtual Adapter
 21...00 ff a3 5c 53 9f ......TeamViewer VPN Adapter
  1...........................Software Loopback Interface 1
  7...84 9d 96 57 56 56 ......Generic Mobile Broadband Adapter
 49...00 15 5d 25 50 96 ......Hyper-V Virtual Ethernet Adapter
===========================================================================

IPv4-Routentabelle
===========================================================================
Aktive Routen:
     Netzwerkziel    Netzwerkmaske          Gateway    Schnittstelle Metrik
          0.0.0.0          0.0.0.0     192.168.88.1    192.168.88.14     50
        127.0.0.0        255.0.0.0   Auf Verbindung         127.0.0.1    331
        127.0.0.1  255.255.255.255   Auf Verbindung         127.0.0.1    331
  127.255.255.255  255.255.255.255   Auf Verbindung         127.0.0.1    331
   172.17.205.176  255.255.255.240   Auf Verbindung    172.17.205.177   5256
   172.17.205.177  255.255.255.255   Auf Verbindung    172.17.205.177   5256
   172.17.205.191  255.255.255.255   Auf Verbindung    172.17.205.177   5256
     192.168.88.0    255.255.255.0   Auf Verbindung     192.168.88.14    306
    192.168.88.14  255.255.255.255   Auf Verbindung     192.168.88.14    306
   192.168.88.255  255.255.255.255   Auf Verbindung     192.168.88.14    306
    192.168.137.0    255.255.255.0   Auf Verbindung     192.168.137.1    306
    192.168.137.1  255.255.255.255   Auf Verbindung     192.168.137.1    306
  192.168.137.255  255.255.255.255   Auf Verbindung     192.168.137.1    306
        224.0.0.0        240.0.0.0   Auf Verbindung         127.0.0.1    331
        224.0.0.0        240.0.0.0   Auf Verbindung     192.168.88.14    306
        224.0.0.0        240.0.0.0   Auf Verbindung     192.168.137.1    306
        224.0.0.0        240.0.0.0   Auf Verbindung    172.17.205.177   5256
  255.255.255.255  255.255.255.255   Auf Verbindung         127.0.0.1    331
  255.255.255.255  255.255.255.255   Auf Verbindung     192.168.88.14    306
  255.255.255.255  255.255.255.255   Auf Verbindung     192.168.137.1    306
  255.255.255.255  255.255.255.255   Auf Verbindung    172.17.205.177   5256
===========================================================================
Ständige Routen:
  Keine

IPv6-Routentabelle
===========================================================================
Aktive Routen:
 If Metrik Netzwerkziel             Gateway
  1    331 ::1/128                  Auf Verbindung
  8    306 fe80::/64                Auf Verbindung
 34    306 fe80::/64                Auf Verbindung
 49   5256 fe80::/64                Auf Verbindung
  8    306 fe80::583:b5c6:49b9:e830/128
                                    Auf Verbindung
 34    306 fe80::7127:a101:c3cf:a4cc/128
                                    Auf Verbindung
 49   5256 fe80::a07d:19cf:66a1:e4eb/128
                                    Auf Verbindung
  1    331 ff00::/8                 Auf Verbindung
  8    306 ff00::/8                 Auf Verbindung
 34    306 ff00::/8                 Auf Verbindung
 49   5256 ff00::/8                 Auf Verbindung
===========================================================================
Ständige Routen:
  Keine
mahdi-malv

mahdi-malv commented on Nov 2, 2020

@mahdi-malv

Any updates on this?
Experiencing this issue with Gradle:6.5 on Windows 10 build 19041

kriegaex

kriegaex commented on Nov 2, 2020

@kriegaex

Experiencing this issue with Gradle:6.4 on Windows 10 build 19041

Hm, are you sure? 6.4 should work, it should start failing at 6.4.1.

mahdi-malv

mahdi-malv commented on Nov 2, 2020

@mahdi-malv

@kriegaex Sorry for typo. I meant 6.5

Likqez

Likqez commented on Nov 26, 2020

@Likqez

Experiencing this on 6.6 too, forced to downgrade gradle for now..

andre-paulo98

andre-paulo98 commented on Dec 5, 2020

@andre-paulo98

Can also reproduce on 6.5, turning off Mobile Hotspot solves the issue.
@big-guy do you still need debug logs?

RaMui

RaMui commented on Dec 21, 2020

@RaMui

Can also reproduce on 6.7.1 with Windows 10 build 19041.488

37 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bughas:workaroundIndicates that the issue has a workaroundin:daemonre:windowsIssue related to using Gradle on Windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @kriegaex@jjohannes@ov7a@big-guy@jbartok

        Issue actions

          gradle an existing connection was forcibly closed by the remote host · Issue #14094 · gradle/gradle