如何在 Spring Boot 中通过对等方复制连接重置?

问题描述

在我的生产环境中,我的服务器出现以下错误

 Cannot forward to error page for request [/api/validation] as the response has already been committed. As a result,the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
org.apache.catalina.connector.ClientAbortException: java.io.IOException: Connection reset by peer

现在我创建了一个客户端并每秒产生 1000 个线程来调用这个 [/api/validation]。 我得到的错误

Exception in thread "Thread-9954" org.springframework.web.client.ResourceAccessException: I/O error on POST request for "http://localhost:7080/v1/name/validate": Timeout waiting for connection from pool; nested exception is org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool.

现在我想知道 Connection reset by peer 的原因是什么。

据我所知,当客户端通过发送 RST 数据包中止连接时,会发生此错误。 我将客户端休息模板的套接字超时设置为 9000。我让服务器休眠大约 15000 毫秒。现在服务器不应该得到 Connection reset by peer,因为服务器会在 15 秒后尝试发送响应,而我的客户端只等待了大约 9 秒。我不应该得到错误吗?

同样在生产环境中,客户端的等待时间(Rest 模板套接字超时)设置为大约 90 秒(超过服务器需要响应的时间)。为什么在生产中会产生错误

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...