Linux services to increase the following
# vi/etc/sysctl. Conf
Net. Ipv4. Tcp_syncookies=1
Net. Ipv4. Tcp_tw_reuse=1
Net. Ipv4. Tcp_tw_recycle=1
Net. Ipv4. Tcp_fin_timeout=30
Net. Ipv4. Tcp_keepalive_time=1800
Net. Ipv4. Tcp_max_syn_backlog=4096
Error is as follows:
03:00:04 2017-08-24. 22781-872 the INFO [pool - 7 - thread - 1] o.a pache, HTTP, impl. Execchain. RetryExec: Retrying requs - & gt; http://www.xx.cn:80
Java.net.SocketException: Connection reset
The at java.net.SocketOutputStream.socketWrite (SocketOutputStream that Java: 118)
The at java.net.SocketOutputStream.write (SocketOutputStream that Java: 159)
The at org. Apache. HTTP. Impl. IO. SessionOutputBufferImpl. StreamWrite (SessionOutputBufferImpl. Java: 124)
The at org. Apache. HTTP. Impl. IO. SessionOutputBufferImpl. FlushBuffer (SessionOutputBufferImpl. Java: 136)
The at org. Apache. HTTP. Impl. IO. SessionOutputBufferImpl. Write (SessionOutputBufferImpl. Java: 167)
The at org. Apache. HTTP. Impl. IO. ContentLengthOutputStream. Write (ContentLengthOutputStream. Java: 113)
The at org. Apache. HTTP. Entity. Mime. Content. FileBody. WriteTo (FileBody. Java: 121)
The at org. Apache. HTTP. Entity. Mime. AbstractMultipartForm. DoWriteTo (AbstractMultipartForm. Java: 134)
The at org. Apache. HTTP. Entity. Mime. AbstractMultipartForm. WriteTo (AbstractMultipartForm. Java: 157)
The at org. Apache. HTTP. Entity. Mime. MultipartFormEntity. WriteTo (MultipartFormEntity. Java: 113)
The at org. Apache. HTTP. Impl. DefaultBHttpClientConnection. SendRequestEntity (DefaultBHttpClientConnection. Java: 156)
The at org. Apache. HTTP. Impl. Conn. CPoolProxy. SendRequestEntity (CPoolProxy. Java: 162)
The at org. Apache. HTTP. Protocol. HttpRequestExecutor. DoSendRequest (HttpRequestExecutor. Java: 238)
The at org. Apache. HTTP. Protocol. HttpRequestExecutor. Execute (HttpRequestExecutor. Java: 123)
The at org. Apache. HTTP. Impl. Execchain. MainClientExec. Execute (MainClientExec. Java: 271)
The at org. Apache. HTTP. Impl. Execchain. ProtocolExec. Execute (ProtocolExec. Java: 184)
The at org. Apache. HTTP. Impl. Execchain. RetryExec. Execute (RetryExec. Java: 88)
The at org. Apache. HTTP. Impl. Execchain. RedirectExec. Execute (RedirectExec. Java: 110)
The at org. Apache. HTTP. Impl. Client. InternalHttpClient. The doExecute (InternalHttpClient. Java: 184)
The at org. Apache. HTTP. Impl. Client. CloseableHttpClient. Execute (CloseableHttpClient. Java: 82)
The at org. Apache. HTTP. Impl. Client. CloseableHttpClient. Execute (CloseableHttpClient. Java: 107)
CodePudding user response:
Two server upload files to this error, change machine code is no problem, also think impassability,CodePudding user response:
Using TCP short link is invalid,//the last solution is to the client and the server unified using TCP short connection
Httppost. SetProtocolVersion (HttpVersion. HTTP_1_0);
Httppost. AddHeader (HTTP. CONN_DIRECTIVE, HTTP. CONN_CLOSE);
CodePudding user response:
This file upload is HTTP, you most likely feel file is too big lead to HTTP transmission timeout; You look at how your HTTP call a timeout value is set, the value in the HTTP transmission time is not connection timeout, values change bigger,CodePudding user response:
The following method is invalidThe browser sends a request to the servlet, the servlet processing time is too long, so lead to chrome ERR_CONNECTION_RESET mistakes
Solution:
In the corresponding servlet execution finally add a code:
Thread. CurrentThread (). The join ();
Said must finish after the carrying out of the current thread to return to the page to the browser,
CodePudding user response:
Link time change again big also invalidInt timeout=60;//this should make it long point
RequestConfig defaultRequestConfig=RequestConfig. Custom ()
SetSocketTimeout (timeout * 1000)
SetConnectTimeout (timeout * 1000)
SetConnectionRequestTimeout (timeout * 1000)
The build ();
CodePudding user response:
CloseableHttpClient httpclient=HttpClientBuilder. The create (). SetDefaultRequestConfig (defaultRequestConfig). The build ();HttpPost HttpPost=new HttpPost (transDto getWebSiteUrl ());
Problem must be out of here, just don't know is what reason,
MultipartEntityBuilder build=MultipartEntityBuilder. The create (). SetMode (HttpMultipartMode. BROWSER_COMPATIBLE);
for(int i=0 ; I & lt; FileList. The size (); I++) {
FileBody FileBody=new FileBody (fileList. Get (I), ContentType. Create (" multipart/form - the data ", "utf-8"));
Build. AddPart (" file "+ I, filebody);
}
StringBody userId=new StringBody (URLEncoder. Encode (JSON. ToJSONString (transDto), "utf-8"), ContentType. Create (" text/plain ", Consts. UTF_8));
Build. AddPart (" data ", userId);
HttpEntity reqEntity=build. SetCharset (CharsetUtils. Get (" utf-8 ")). The build ();
Httppost. SetEntity (reqEntity);
Logger. GetLogger (HttpUploadUtils. Class. GetName ()). The log (Level. The INFO, "execute the request:" + httppost. GetRequestLine ());
CloseableHttpResponse response=httpclient. Execute (httppost);
CodePudding user response:
Last, the conclusion, please? I also encountered this problem