我的Jetty应用服务器出现问题。从昨天开始,我们有一个大问题。有时,Jetty似乎只是挂起,不想进行任何RPC调用。如果我重新启动它,它会恢复到正常状态,但问题会在数小时后回滚。码头服务器挂起
我注意到,Nginx的提示这个错误日志,当我们有问题:
2012/05/17 17:00:47 [error] 14728#0: *506735 upstream timed out (110: Connection timed out) while reading response header from upstream, client: xx.xxx.xxx.xx, server: www.MY-SERVER.com, request: "POST /com.xxxx.xxxx.XXXX/Service HTTP/1.1", upstream: "http://127.0.0.1:8080/com.xxxx.xxxx.XXXX/Service", host: "www.MY-SERVER.com", referrer: "https://www.MY-SERVER.com/"
即使它的工作好,Nginx的提示这样的警告:
2012/05/17 17:04:44 [warn] 14728#0: *506906 a client request body is buffered to a temporary file /var/cache/nginx/client_temp/0000088415,
客户端:xx.xxx .xxx.xx,服务器:www.MY-SERVER.com, 请求:“POST/report HTTP/1.1”,主机:“www.MY-SERVER.com” 这是惊人的吗?
我听说,当Jetty像这样挂起可能是因为线程问题。我如何验证?这是我的服务器线程池配置,可能有助于诊断问题。
<!-- =========================================================== -->
<!-- Server Thread Pool -->
<!-- =========================================================== -->
<Set name="ThreadPool">
<!-- Default queued blocking threadpool -->
<New class="org.eclipse.jetty.util.thread.QueuedThreadPool">
<Set name="minThreads">10</Set>
<Set name="maxThreads">200</Set>
<Set name="detailedDump">false</Set>
</New>
</Set>
<!-- =========================================================== -->
<!-- Set connectors -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
<Set name="host"><Property name="jetty.host" /></Set>
<Set name="port"><Property name="jetty.port" default="8080"/></Set>
<Set name="maxIdleTime">300000</Set>
<Set name="Acceptors">2</Set>
<Set name="statsOn">false</Set>
<Set name="confidentialPort">8443</Set>
<Set name="lowResourcesConnections">20000</Set>
<Set name="lowResourcesMaxIdleTime">5000</Set>
</New>
</Arg>
</Call>
我设法隔离了这个问题。它在一个特定的servlet中。我分析了Jetty似乎挂起的线程,并发现它正在等待事务与数据库交互(transaction.begin())。我面临着僵局。我进行了进一步的搜索并设法找到某些地方,例外情况在提出时不会关闭交易。我已经在catch部分放置了transaction.commit()或transaction.rollback()。一切都很方便,解决了我的问题! – FrozZerrer