访问应用程序时出现代理错误
我在浏览器和自定义 Web 服务器之间有一个 apache 代理。因此,启动网络服务器后,我可以访问我的网络应用程序大约 4-5 小时。之后我得到这个错误
代理错误代理服务器收到来自无效响应 上游服务器。代理服务器无法处理请求 GET /。
原因:从远程服务器读取时出错
要再次访问 Web 应用程序,我必须重新启动 Web 服务器。我尝试检查从网络服务器获取的日志,但该日志中只有错误,我发现是这样的
com.mysql.jdbc.CommunicationsException:通信链路失败 由于潜在的异常:
** 开始嵌套异常 **
java.net.SocketException 消息:连接超时
堆栈跟踪:
java.net.SocketException:连接超时 在 java.net.SocketInputStream.socketRead0(本机方法) 在 java.net.SocketInputStream.read(SocketInputStream.java:146) 在 com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113) 在 com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160) 在 com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188) 在 com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1910) 在com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304) 在 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803) 在 com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573) 在 com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665) 在 com.mysql.jdbc.Connection.execSQL(Connection.java:3170) 在 com.mysql.jdbc.Connection.execSQL(Connection.java:3099) 在 com.mysql.jdbc.Statement.execute(Statement.java:695) 在 hra.database.Pool.getConnection(Pool.java:62)
** 结束嵌套异常 **
最后发送到服务器的数据包是在 925624 毫秒前。
我尝试修复此数据库错误,但仍然收到上述代理错误,因此日志信息肯定没有用。
这是我从 Apache 代理日志中得到的信息
(70007)指定的超时已过期:代理:读取状态时出错 来自远程服务器的线路
有谁知道可能是什么问题或有任何有用的指示来解决此问题?
I have an apache proxy between browser and my custom web server. So after starting the webserver, I can access my web application for like 4-5 hours. After that I get this error
Proxy Error The proxy server received an invalid response from an
upstream server. The proxy server could not handle the request GET /.Reason: Error reading from remote server
To access the web application again, I have to restart the web server. I tried to check the log I got from my web server and only error in that log , I am finding is this
com.mysql.jdbc.CommunicationsException: Communications link failure
due to underlying exception:** BEGIN NESTED EXCEPTION **
java.net.SocketException MESSAGE: Connection timed out
STACKTRACE:
java.net.SocketException: Connection timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:146)
at com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
at com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
at com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1910)
at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2304)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2803)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.Statement.execute(Statement.java:695)
at hra.database.Pool.getConnection(Pool.java:62)** END NESTED EXCEPTION **
Last packet sent to the server was 925624 ms ago.
And I tried to fix this database error, but I still get the above mentioned proxy error, so definitely the log information is not useful.
This is what I am getting from Apache Proxy log
(70007)The timeout specified has expired: proxy: error reading status
line from remote server
Does anyone know what can be the issue or any helpful pointers to fix this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
apache 代理失败,因为 customwebserver 没有应答。你的
customwebserver 记录了一个等待 mysql 应答的崩溃。重新启动
customwebserver 可以修复它,因此 mysql 不是问题。看起来问题出在您的自定义网络服务器处理与 mysql 的连接的方式上。
我们可以看看你的 jdbc 配置吗?你有 autoReconnect=true 吗?
apache proxy fails because customwebserver does not answer. your
customwebserver logs a crash waiting for mysql to answer. rebooting
customwebserver fixes it, so mysql is not the problem. it looks like the problem the way your customwebserver handles its connections to mysql.
can we see your jdbc config? do you have autoReconnect=true ?
可能发生的情况是您的上游服务器由于不活动而自行关闭。在服务器上找到控制它的设置并将其打开。
What is likely happening is that your up-stream server is shutting itself down because of inactivity. Find the setting on the server that controls that and turn it up.
我可以看到您看到两个连接超时错误
如果代理服务器上设置的超时小于设置的超时对于数据库连接,在数据库连接超时之前,代理服务器也会超时。
ProxyTimeout
设置为是一个大于(最大响应时间)+(网络延迟)的值。如果可能,您可以共享代理服务器配置以进一步帮助您。
I can see that you see two connection timeout errors
If the timeout set on proxy server is less than timeout set for database connection, before the database connection times out, proxy server would time out as well.
ProxyTimeout
to be a value that is more than (max response time) + (network delay)If possible you may share proxy server configurations to help you further.
我认为就像前面的答案所述,您遇到了由基础设施成员之一引发的超时:
您是否设置了真正的连接池?使用心跳机制来保持连接?
这会引起一些网络流量但避免此类问题?
尝试使用网络抓包工具有很多日志来分析
HTH
杰罗姆
I think like stated by the previous answer that you encounter a timeout raised by one of the members of your infrastructure:
Did you setup a real connection pool ? Using heart beat mechanism to keep alive connections ?
This induces some network traffic but avoids such problems ?
Try to use a network capture tool to have many logs to analyze
HTH
jerome