blackd / Inventory-Profiles

Take control over you inventory. Sort. Move matching/all Items. Throw all/all items. Locked slots. Gear sets! And much more!
https://inventory-profiles-next.github.io/
GNU Affero General Public License v3.0
152 stars 50 forks source link

Analytics server being down causes game to crash #325

Closed EthanZeigler closed 1 year ago

EthanZeigler commented 1 year ago

So, uh... This is a big boy mistake.

When the analytics server is down and analytics are enabled, the entire game client crashes.

[00:30:17] [pool-8-thread-2/ERROR]: [libIPN] 
java.io.IOException: Server returned HTTP response code: 503 for URL: https://p.anti-ad.org/api/event
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) ~[?:?]
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) ~[?:?]
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) ~[?:?]
    at org.anti_ad.mc.common.moreinfo.InfoManagerBase.sendEvent(InfoManagerBase.kt:110) ~[libIPN-fabric-1.19.4-2.0.4.jar:?]
    at org.anti_ad.mc.common.moreinfo.InfoManagerBase.doEvent$lambda$0(InfoManagerBase.kt:81) ~[libIPN-fabric-1.19.4-2.0.4.jar:?]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
    at java.lang.Thread.run(Unknown Source) ~[?:?]

At the time of writing the analytics server appears to be down and there's no error handling for this scenario.

https://github.com/blackd/Inventory-Profiles/blob/88d0fd3a4b1cc60b38825d31affab653802bde69/shared-sources/src/main/java/org/anti_ad/mc/ipnext/IPNInfoManager.kt#L45

blackd commented 1 year ago

the server have been down for ages.

is it that you just get errors in the logs or it's a real crash

EthanZeigler commented 1 year ago

Real crash, sadly. Server(ish) stops responding directly after this error and the client closes. Disabling and enabling the analytics sadly causes it to work or fail respectfully. This is all on single player btw.

blackd commented 1 year ago

I can't recreate the crash. I just see the exception in the logs.

EthanZeigler commented 1 year ago

Very weird.

I'll experiment with this some more tomorrow and see if I can get a better explanation of what's actually happening. Maybe something else in the logging about why it closed.

blackd commented 1 year ago

the analytics server us up once more

but in the next release I'll make sure that the exception is not logged

blackd commented 1 year ago

and I checked the code it's ran in separate thread and the exception is just logged

            executor.execute {
                try {
                    sendEvent(name, value)
                } catch (t: Throwable) {
                    Log.error("", t)
                }
            }
EthanZeigler commented 1 year ago

im unable to replicate it now. I guess that's a good thing? lol