Skip to content

The Unified and Autonomous Development Platform

Use commons 1.0.13 to fix Git push hanging issue

Robin Shenbc3503b1733d
diff --git a/core/src/main/java/io/onedev/server/git/GitFilter.java b/core/src/main/java/io/onedev/server/git/GitFilter.java
index e63a2863f2..415e91dc0f 100644
--- a/core/src/main/java/io/onedev/server/git/GitFilter.java
+++ b/core/src/main/java/io/onedev/server/git/GitFilter.java
@@ -2,6 +2,8 @@ package io.onedev.server.git;
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutionException;
@@ -148,10 +150,9 @@ public class GitFilter implements Filter {
@Override
public void run() {
try {
- new UploadCommand(gitDir, environments)
- .input(ServletUtils.getInputStream(request))
- .output(response.getOutputStream())
- .call();
+ InputStream is = ServletUtils.getInputStream(request);
+ OutputStream os = response.getOutputStream();
+ new UploadCommand(gitDir, environments).input(is).output(os).call();
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -167,10 +168,9 @@ public class GitFilter implements Filter {
@Override
public void run() {
try {
- new ReceiveCommand(gitDir, environments)
- .input(ServletUtils.getInputStream(request))
- .output(response.getOutputStream())
- .call();
+ InputStream is = ServletUtils.getInputStream(request);
+ OutputStream os = response.getOutputStream();
+ new ReceiveCommand(gitDir, environments).input(is).output(os).call();
} catch (IOException e) {
throw new RuntimeException(e);
}
@@ -223,7 +223,7 @@ public class GitFilter implements Filter {
FilterChain chain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
-
+
try {
if (GitSmartHttpTools.isInfoRefs(httpRequest)) {
if (oneDev.isReady())
diff --git a/core/src/main/java/io/onedev/server/util/serverconfig/ServerConfig.java b/core/src/main/java/io/onedev/server/util/serverconfig/ServerConfig.java
index 16f09d7f01..1bf17784b8 100644
--- a/core/src/main/java/io/onedev/server/util/serverconfig/ServerConfig.java
+++ b/core/src/main/java/io/onedev/server/util/serverconfig/ServerConfig.java
@@ -29,4 +29,5 @@ public interface ServerConfig {
* web session timeout in seconds
*/
int getSessionTimeout();
+
}
diff --git a/pom.xml b/pom.xml
index a80910377b..0dc1f3f730 100644
--- a/pom.xml
+++ b/pom.xml
@@ -210,7 +210,7 @@
</repository>
</repositories>
<properties>
- <commons.version>1.0.12</commons.version>
+ <commons.version>1.0.13</commons.version>
<antlr.version>4.7.2</antlr.version>
</properties>
</project>
diff --git a/product/src/main/java/io/onedev/server/product/DefaultServerConfig.java b/product/src/main/java/io/onedev/server/product/DefaultServerConfig.java
index 2692567238..8975fe3aaa 100644
--- a/product/src/main/java/io/onedev/server/product/DefaultServerConfig.java
+++ b/product/src/main/java/io/onedev/server/product/DefaultServerConfig.java
@@ -25,8 +25,8 @@ public class DefaultServerConfig implements ServerConfig {
private int httpPort;
- private int sessionTimeout;
-
+ private int sessionTimeout = 1800;
+
private SslConfig sslConfig;
@Inject
@@ -75,10 +75,7 @@ public class DefaultServerConfig implements ServerConfig {
String sessionTimeoutStr = props.getProperty("sessionTimeout");
if (StringUtils.isNotBlank(sessionTimeoutStr))
- this.sessionTimeout = Integer.parseInt(sessionTimeoutStr.trim());
- else
- throw new RuntimeException("sessionTimeout is not specified.");
-
+ sessionTimeout = Integer.parseInt(sessionTimeoutStr.trim());
}
@Override
diff --git a/product/system/conf/server.properties b/product/system/conf/server.properties
index 3fa1b4d420..4ed474395d 100644
--- a/product/system/conf/server.properties
+++ b/product/system/conf/server.properties
@@ -1,16 +1,16 @@
-# Specify how long an inactive http(s) session will last in seconds.
+# Specify how long an inactive http(s) session will last in seconds
#
sessionTimeout=1800
# Specify http port. Comment out this if you do not want to enable plain http protocol if
-# you've already enabled https support.
+# you've already enabled https support
#
httpPort=6610
# Uncomment below to enable https support. For production use, please also make sure
# to uncomment various keystore properties below to specify your custom keystore for
# security reason; Otherwise, an internal sample keystore will be used for testing
-# purpose.
+# purpose
#
httpsPort=6643
@@ -22,7 +22,7 @@ httpsPort=6643
# http://www.eclipse.org/jetty/documentation/current/configuring-ssl.html
#
# Specify path to keystore file. A non-absolute path is considered to be relative to
-# the directory containing this property file.
+# the directory containing this property file
#
#keystorePath=
#