spring-boot - 如何在 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 template socket time out)设置为大约 90 秒(超过服务器响应所需的时间)。为什么生产中会产生错误?
解决方案
推荐阅读
- tfs - 以编程方式在我的 ASP .net Core Web API 中获取 TFS 工作项详细信息?
- javascript - PHP 返回具有相似值的行 - 必须匹配第一个单词
- angular - Ionic 4 Angular 8 Razorpay 支付网关集成错误
- c# - 当我按下 wpf .net 核心应用程序中的按钮时,我想在 VLC 媒体播放器中打开特定的视频文件 (mp4)
- dll - VB6:获取 DLL 的当前路径
- php - 显示数据时不显示趋势线
- c++ - leetcode 540 上的运行时错误。排序数组中的单个元素
- yaml - 从 kubernetes yaml 配置中的秘密映射中获取多个密钥的简写语法
- python - 访问 sklearn 管道中的属性
- php - 当我使用 get api 时,我想使用数据库中的字段作为下拉列表