2016-03-05 84 views
1

我在Apache Tomcat 7上部署了一个Grails应用程序。上周由于空的线程池导致应用程序关闭,但没有太多的用户来做这件事。当我查看服务器时,发现端口8080上有很多未关闭的java线程和tcp进程 - 处于CLOSE_WAIT状态。Grails应用程序中的许多持久CLOSE_WAIT连接

Screenshot of netstat for 8080 port

的应用与远程MSSQL数据库,并且还通过groovy.net.http.RestClient远程CRM系统通信。作为一个网络服务器,我们使用Nginx。我查看了所有日志(tomcat,nginx访问日志)并没有意识到任何奇怪的活动。有没有人在类似的技术上面临这样的问题?

Grails的版本是2.3.7

这里有一个连接设置DB:

production { 
    dataSource { 
     // Production MS SQL database configuration 
     //pooled = true 
     driverClassName = "net.sourceforge.jtds.jdbc.Driver" 
     url = "jdbc:jtds:sqlserver://blahblahblah" 
     username = "username" 
     password = "password" 
     dbCreate = "none" 
     properties { 
      // See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation 
      jmxEnabled = true 
      initialSize = 5 
      maxActive = 1250 
      minIdle = 20 
      maxIdle = 100 
      maxWait = 15000 
      maxAge = 10 * 60000 
      timeBetweenEvictionRunsMillis = 5000 
      minEvictableIdleTimeMillis = 60000 
      validationQuery = "SELECT 1" 
      validationQueryTimeout = 3 
      validationInterval = 15000 
      testOnBorrow = true 
      testWhileIdle = true 
      testOnReturn = false 
      jdbcInterceptors = "ConnectionState" 
      defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_UNCOMMITTED 
     } 
    } 
    } 

UPDATE

我发现了CLOSE_WAIT连接在同一时间发生的nginx的499错误 - 客户端关闭请求。

+0

什么版本的Grails?你可以把一个mssql连接代码。它使用连接池吗? – Arjang

+0

我更新了问题。 – sovanegger

回答

0

我没有Grails 2项目了。我从来没有见过这个错误。但我通常不使用jtds驱动程序。这是我使用的。

driverClassName: "com.mysql.jdbc.Driver" 
dialect: "org.hibernate.dialect.MySQL5InnoDBDialect" 
url: "jdbc:mysql://localhost/myroject?useUnicode=yes&characterEncoding=UTF-8" 

我记得以前我不得不下载DB驱动并将它添加到lib目录。

+0

我发现CLOSE_WAIT连接与nginx 499错误 - 客户端关闭请求同时发生。 – sovanegger