From 76615f13f2dc9dd001cafee78b151555385f3809 Mon Sep 17 00:00:00 2001 From: Josh Eckels Date: Mon, 22 Sep 2025 17:38:28 -0700 Subject: [PATCH 1/2] Add a timeout for querying for Uniprot features (#931) --- protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java | 2 +- protein/src/org/labkey/protein/ProteinServiceImpl.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java b/protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java index aebfbd5291..039b7edf1e 100644 --- a/protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java +++ b/protein/api-src/org/labkey/api/protein/fasta/FastaProtein.java @@ -84,7 +84,7 @@ public FastaProtein(String header, byte[] bytes) if (header.startsWith("gi|")) { firstAliasIndex = header.indexOf(" gi|", 2) + 1; - if (firstAliasIndex < 0 || firstAliasIndex > 30) + if (firstAliasIndex > 30) firstAliasIndex = 0; } diff --git a/protein/src/org/labkey/protein/ProteinServiceImpl.java b/protein/src/org/labkey/protein/ProteinServiceImpl.java index 269edcdb26..ebc15cf0ac 100644 --- a/protein/src/org/labkey/protein/ProteinServiceImpl.java +++ b/protein/src/org/labkey/protein/ProteinServiceImpl.java @@ -300,6 +300,8 @@ public List load(@NotNull String accession, @Nullable Object arg HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestProperty("Accept", "application/xml"); con.setRequestMethod("GET"); + con.setConnectTimeout(20_000); + con.setReadTimeout(20_000); int responseCode = con.getResponseCode(); if (responseCode == HttpURLConnection.HTTP_OK) { // success From 97cd374fcfc0f99e35170fc1eb96d7b6daa11352 Mon Sep 17 00:00:00 2001 From: labkey-jeckels Date: Wed, 24 Sep 2025 10:16:05 -0700 Subject: [PATCH 2/2] Backport: Timeout for querying for Uniprot features --- protein/src/org/labkey/protein/ProteinServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protein/src/org/labkey/protein/ProteinServiceImpl.java b/protein/src/org/labkey/protein/ProteinServiceImpl.java index ebc15cf0ac..cae1ac8ea9 100644 --- a/protein/src/org/labkey/protein/ProteinServiceImpl.java +++ b/protein/src/org/labkey/protein/ProteinServiceImpl.java @@ -372,7 +372,7 @@ else if (location.getChildNodes().getLength() == 2) { if (responseCode != 404) { - LOG.error("HTTP GET failed to " + url + " with error code " + responseCode); + LOG.warn("HTTP GET failed to " + url + " with error code " + responseCode); } else {