From b81ad3f0dbd6401319fde206019054265d155091 Mon Sep 17 00:00:00 2001 From: Hancho1577 Date: Sat, 19 Mar 2022 20:45:19 +0700 Subject: [PATCH] Prevent async task pool from being full (#2894) Fixes #2883 --- core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java | 2 ++ core/src/main/java/org/geysermc/geyser/util/WebUtils.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java index 4383dc4e9..282f6875a 100644 --- a/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java +++ b/core/src/main/java/org/geysermc/geyser/skin/SkinProvider.java @@ -601,6 +601,8 @@ public class SkinProvider { HttpURLConnection con = (HttpURLConnection) new URL(imageUrl).openConnection(); con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); + con.setConnectTimeout(10000); + con.setReadTimeout(10000); BufferedImage image = ImageIO.read(con.getInputStream()); if (image == null) throw new NullPointerException(); diff --git a/core/src/main/java/org/geysermc/geyser/util/WebUtils.java b/core/src/main/java/org/geysermc/geyser/util/WebUtils.java index 40daf22c7..fe479363f 100644 --- a/core/src/main/java/org/geysermc/geyser/util/WebUtils.java +++ b/core/src/main/java/org/geysermc/geyser/util/WebUtils.java @@ -52,6 +52,8 @@ public class WebUtils { HttpURLConnection con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setRequestProperty("User-Agent", "Geyser-" + GeyserImpl.getInstance().getPlatformType().toString() + "/" + GeyserImpl.VERSION); // Otherwise Java 8 fails on checking updates + con.setConnectTimeout(10000); + con.setReadTimeout(10000); return connectionToString(con); } catch (Exception e) {