Normally this works because you either get a response or it fails. But sometimes, in some random cases of network issues, there is no response at all and it will hang, waiting forever for a nonexistent response.
Interesting. it depends on the javac implementation it seems. Anyways if you want to set a timeout feel free to submit a pr. I'm fine with whatever as this is a dumb edge case
This is one of java's dumb default: https://github.com/MinecraftForge/ForgeGradle/blob/63b758333137a929ae37186ff8c10d1335f934d0/src/common/java/net/minecraftforge/gradle/common/util/DownloadUtils.java#L213-L237 if you don't explicitly set a timeout value, it will wait indefinitely for a response that may never arrive.
Normally this works because you either get a response or it fails. But sometimes, in some random cases of network issues, there is no response at all and it will hang, waiting forever for a nonexistent response.