AlexModGuy / Citadel

A Library containing shared code used throughout most of my projects. Can be considered a continuation of LLibrary, of which this borrows the majority of its source code from.
24 stars 28 forks source link

No timeout mechism and cause WebHelper stuck the server bootup forever #144

Open Ghost-chu opened 6 months ago

Ghost-chu commented 6 months ago

My server stucked on booting for really long, so I decide use jstack to check what happen, and it seems Citadel's WebHelper stucked on a web request forever (no timeout setting), The quality of my internet is a little bad, but the lack of a timeout is something that should never happen, it stops the game/server from starting forever.

https://github.com/AlexModGuy/Citadel/blob/af40cba27144d12040e0af13b195279cec5902e3/src/main/java/com/github/alexthe666/citadel/web/WebHelper.java#L15

"modloading-worker-0" #26 daemon prio=5 os_prio=0 cpu=4573.41ms elapsed=323.40s tid=0x00007f56a7bd3b90 nid=0x50 runnable  [0x00007f560dfb2000]
   java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.SocketDispatcher.read0(java.base@17.0.9/Native Method)
    - parking to wait for  <0x0000000593bf15e0> (a java.util.concurrent.ForkJoinPool)
    at sun.nio.ch.SocketDispatcher.read(java.base@17.0.9/SocketDispatcher.java:47)
    at sun.nio.ch.NioSocketImpl.tryRead(java.base@17.0.9/NioSocketImpl.java:266)
    at sun.nio.ch.NioSocketImpl.implRead(java.base@17.0.9/NioSocketImpl.java:317)
    at sun.nio.ch.NioSocketImpl.read(java.base@17.0.9/NioSocketImpl.java:355)
    at sun.nio.ch.NioSocketImpl$1.read(java.base@17.0.9/NioSocketImpl.java:808)
    at java.net.Socket$SocketInputStream.read(java.base@17.0.9/Socket.java:966)
    at sun.security.ssl.SSLSocketInputRecord.read(java.base@17.0.9/SSLSocketInputRecord.java:484)
    at sun.security.ssl.SSLSocketInputRecord.readHeader(java.base@17.0.9/SSLSocketInputRecord.java:478)
    at sun.security.ssl.SSLSocketInputRecord.decode(java.base@17.0.9/SSLSocketInputRecord.java:160)
    at sun.security.ssl.SSLTransport.decode(java.base@17.0.9/SSLTransport.java:111)
    at sun.security.ssl.SSLSocketImpl.decode(java.base@17.0.9/SSLSocketImpl.java:1510)
    at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(java.base@17.0.9/SSLSocketImpl.java:1425)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@17.0.9/SSLSocketImpl.java:455)
    at sun.security.ssl.SSLSocketImpl.startHandshake(java.base@17.0.9/SSLSocketImpl.java:426)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(java.base@17.0.9/HttpsClient.java:589)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(java.base@17.0.9/AbstractDelegateHttpsURLConnection.java:187)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(java.base@17.0.9/HttpURLConnection.java:1665)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(java.base@17.0.9/HttpURLConnection.java:1589)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(java.base@17.0.9/HttpsURLConnectionImpl.java:224)
    at com.github.alexthe666.citadel.web.WebHelper.getURLContents(citadel@2.1.4/WebHelper.java:19)
    at com.github.alexthe666.citadel.Citadel.setup(citadel@2.1.4/Citadel.java:142)
    at com.github.alexthe666.citadel.Citadel$$Lambda$22310/0x00007f56128f6d60.accept(citadel@2.1.4/Unknown Source)
    at net.minecraftforge.eventbus.EventBus.doCastFilter(net.minecraftforge.eventbus/EventBus.java:260)
    at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(net.minecraftforge.eventbus/EventBus.java:252)
    at net.minecraftforge.eventbus.EventBus$$Lambda$4443/0x00007f5610c3f178.invoke(net.minecraftforge.eventbus/Unknown Source)
    at net.minecraftforge.eventbus.EventBus$$Lambda$4440/0x00007f5610c3ead0.invoke(net.minecraftforge.eventbus/Unknown Source)
    at net.minecraftforge.eventbus.EventBus.post(net.minecraftforge.eventbus/EventBus.java:315)
    at net.minecraftforge.eventbus.EventBus.post(net.minecraftforge.eventbus/EventBus.java:296)
    at net.minecraftforge.fml.javafmlmod.FMLModContainer.acceptEvent(javafmllanguage@1.19.2-43.3.2/FMLModContainer.java:114)
    at net.minecraftforge.fml.ModContainer.lambda$buildTransitionHandler$10(fmlcore@1.19.2-43.3.2/ModContainer.java:122)
    at net.minecraftforge.fml.ModContainer$$Lambda$4413/0x00007f5610c44ba8.run(fmlcore@1.19.2-43.3.2/Unknown Source)
    at java.util.concurrent.CompletableFuture$AsyncRun.run(java.base@17.0.9/CompletableFuture.java:1804)
    at java.util.concurrent.CompletableFuture$AsyncRun.exec(java.base@17.0.9/CompletableFuture.java:1796)
    at java.util.concurrent.ForkJoinTask.doExec(java.base@17.0.9/ForkJoinTask.java:373)
    at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(java.base@17.0.9/ForkJoinPool.java:1182)
    at java.util.concurrent.ForkJoinPool.scan(java.base@17.0.9/ForkJoinPool.java:1655)
    at java.util.concurrent.ForkJoinPool.runWorker(java.base@17.0.9/ForkJoinPool.java:1622)
    at java.util.concurrent.ForkJoinWorkerThread.run(java.base@17.0.9/ForkJoinWorkerThread.java:165)