Gradle Daemon stuck at IDLE and never ends on Windows

I upgraded my PC to 24H2 and then 25H2 today and and I’m happy to say that I’ve found the root of the problem and fixed it.

The fact is, this is indeed a bug in Windows, and it remains unfixed (at least on the release branch, I don’t use preview Windows). Their optimizations for loopback interface broke BBR2 congestion control algorithm compatibility since 24H2, which breaks Gradle and made it hanging.

The default value of the congestion control algorithm is not BBR2 so that would not affect most of the Windows users. For later viewers, if you have set to use BBR somehow, there is 2 solutions to fix the issue:

Solution 1: Open Powershell (Administrator) and execute the following command to set “Internet” CC to cubic:

netsh int tcp set supplemental Template=Internet CongestionProvider=cubic

There’s also command for checking your current CC settings:

Get-NetTCPSetting | Select SettingName, CongestionProvider

Solution 2: You can also disable the loopback large MTU optimization to fix the problem so you can still use BBR2:

netsh int ipv4 set gl loopbacklargemtu=disable
netsh int ipv6 set gl loopbacklargemtu=disable

Hopefully this would help more ppl suffering from this like me. :smiling_face_with_three_hearts: