From c3761e4f444a4be7db5aa58ebdcd03b2d092aeb4 Mon Sep 17 00:00:00 2001
From: standlove
Date: Mon, 28 Nov 2022 13:19:49 +0800
Subject: [PATCH 1/6] fix crash
---
.../services/view/ajax/CustomFormatAJAXResult.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
index 2cf7da282..13c195198 100644
--- a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
+++ b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
@@ -8,6 +8,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.SocketException;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.util.zip.GZIPOutputStream;
@@ -81,6 +82,13 @@
*
*
*
+ * Version 1.2
+ *
+ * - Fixed crash - java.net.SocketException: Broken pipe
+ *
+ *
+ *
+ *
* Thread safety: Technically this class is NOT thread safe since it has mutable states, but the intended
* usage of the mutators is for IoC injection and thus we expect for these values not to be changed after
* initialization. Thus this class can be considered as thread-safe conditional in an IoC injection usage of
@@ -88,7 +96,7 @@
*
*
* @author AleaActaEst, TCSDEVELOPER, duxiaoyang
- * @version 1.1
+ * @version 1.2
*/
@SuppressWarnings("serial")
public class CustomFormatAJAXResult implements Result {
@@ -300,11 +308,13 @@ private static void writeDataAndClose(InputStream in, OutputStream out) throws I
}
// flush output stream
out.flush();
+ } catch (SocketException e) {
+ // The client side has aborted or closed connection
} finally {
// close the input stream
closeStream(in);
// close the output stream
- out.close();
+ closeStream(out);
}
}
From 6d36796ba5b01f14a6f12c4059943f662e3b4710 Mon Sep 17 00:00:00 2001
From: standlove
Date: Mon, 28 Nov 2022 14:26:30 +0800
Subject: [PATCH 2/6] update ci
---
.circleci/config.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 3d337fabb..533477881 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -11,7 +11,8 @@ install_dependency: &install_dependency
apt install -y openssl ant git zip jq
mkdir ~/awscli
cd ~/awscli
- curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
+ #curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
+ curl https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.188.zip -o awscli-bundle.zip
unzip awscli-bundle.zip
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
cd /usr/share/ant/lib
From 1d44f92b388a72d4fad709fa756bca1363458e13 Mon Sep 17 00:00:00 2001
From: standlove
Date: Mon, 28 Nov 2022 14:31:40 +0800
Subject: [PATCH 3/6] update ci
---
.circleci/config.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 533477881..94ee0ce3f 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -8,7 +8,7 @@ install_dependency: &install_dependency
command: |
sed -i '/jessie-updates/d' /etc/apt/sources.list
apt update
- apt install -y openssl ant git zip jq
+ apt install -y --force-yes openssl ant git zip jq
mkdir ~/awscli
cd ~/awscli
#curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
From e113ec6623c738b97b153f2cdcbfce11e8d52141 Mon Sep 17 00:00:00 2001
From: standlove
Date: Fri, 9 Dec 2022 15:36:40 +0800
Subject: [PATCH 4/6] ignore io exception
---
.../direct/services/view/ajax/CustomFormatAJAXResult.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
index 13c195198..e9d2e03a0 100644
--- a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
+++ b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
@@ -308,7 +308,7 @@ private static void writeDataAndClose(InputStream in, OutputStream out) throws I
}
// flush output stream
out.flush();
- } catch (SocketException e) {
+ } catch (IOException e) {
// The client side has aborted or closed connection
} finally {
// close the input stream
From 0370a851d9358fe679ad62cb53ea6626d3d23542 Mon Sep 17 00:00:00 2001
From: standlove
Date: Fri, 9 Dec 2022 23:01:11 +0800
Subject: [PATCH 5/6] update build config
---
.circleci/config.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 94ee0ce3f..895955f0b 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -25,7 +25,7 @@ install_dependency: &install_dependency
install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
- git clone --branch v1.3 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
+ git clone --branch v1.4.14 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript
cp ./../buildscript/master_deploy.sh .
cp ./../buildscript/buildenv.sh .
cp ./../buildscript/awsconfiguration.sh .
From 4b670d5152682ea9c72f00bbff7df3510a42116a Mon Sep 17 00:00:00 2001
From: standlove
Date: Wed, 21 Dec 2022 09:39:01 +0800
Subject: [PATCH 6/6] log client aborted error
---
.../direct/services/view/ajax/CustomFormatAJAXResult.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
index e9d2e03a0..35fbadda6 100644
--- a/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
+++ b/src/java/main/com/topcoder/direct/services/view/ajax/CustomFormatAJAXResult.java
@@ -25,6 +25,7 @@
import com.topcoder.direct.services.view.action.contest.launch.AggregateDataModel;
import com.topcoder.direct.services.view.ajax.processors.DefaultAJAXResultPreProcessor;
import com.topcoder.direct.services.view.ajax.serializers.JSONDataSerializer;
+import org.apache.log4j.Logger;
/**
*
@@ -185,6 +186,8 @@ public class CustomFormatAJAXResult implements Result {
*/
private boolean enabledGzip = false;
+ private Logger logger = Logger.getLogger(CustomFormatAJAXResult.class);
+
/**
*
* Default constructor.
@@ -298,7 +301,7 @@ public void execute(ActionInvocation invocation) throws AJAXDataPreProcessingExc
* @throws IOException
* if any io error happens
*/
- private static void writeDataAndClose(InputStream in, OutputStream out) throws IOException {
+ private void writeDataAndClose(InputStream in, OutputStream out) throws IOException {
try {
// Write input stream to output stream
byte[] buf = new byte[BUFFER_SIZE];
@@ -310,6 +313,7 @@ private static void writeDataAndClose(InputStream in, OutputStream out) throws I
out.flush();
} catch (IOException e) {
// The client side has aborted or closed connection
+ logger.error("The client side has aborted or closed connection", e);
} finally {
// close the input stream
closeStream(in);