简体   繁体   English

为什么连接没有超时?

[英]Why are the connections not timing out?

Running my application on Websphere Application Server 7 with SQLServer 2008 database. 使用SQLServer 2008数据库在Websphere Application Server 7上运行我的应用程序。 When the SQLServer is at 100% every connection is hanging and filling up the connection pool. 当SQLServer为100%时,每个连接都挂起并填满连接池。 This leads to every thread also hanging. 这导致每个线程也挂起。 And after 10 minutes the log is filled with this: 10分钟后,日志填满了这个:

00000042 ThreadMonitor W   WSVR0605W: Thread "WebContainer : 11" (00000049) has been active for 742352 milliseconds and may be hung.  There is/are 14 thread(s) in total in the server that may be hung.

The connection pool is using JTDS and has a timeout set to 300 sec. 连接池使用JTDS,超时设置为300秒。

I would pressume that after 300sec every connection whould throw an exception which would then make all the threads un-hang? 我会压缩300sec后,每个连接都会抛出一个异常,然后让所有的线程都挂起来?

Why would the connection throw an exception after 300 seconds?. 为什么连接会在300秒后抛出异常? If the connection object is in use, it will continue to be alive. 如果连接对象正在使用中,它将继续处于活动状态。

Also specify the exact time out attribute that you are referring to? 还要指定您所指的确切超时属性?

Here is the definition for Connection Timeout : 以下是连接超时的定义:

This value indicates the number of seconds that a connection request waits when there are no connections available in the free pool and no new connections can be created. 此值指示当空闲池中没有可用连接且无法创建新连接时连接请求等待的秒数。 This usually occurs because the maximum value of connections in the particular connection pool has been reached. 这通常是因为已达到特定连接池中的连接的最大值。

For example, if Connection timeout is set to 300, and the maximum number of connections are all in use, the pool manager waits for 300 seconds for a physical connection to become available. 例如,如果“连接超时”设置为300,并且最大连接数都在使用中,则池管理器将等待300秒以使物理连接可用。 If a physical connection is not available within this time, the pool manager initiates a ConnectionWaitTimeout exception. 如果在此时间内没有物理连接,则池管理器会启动ConnectionWaitTimeout异常。

So, it does not make 'all the threads un-hang', it only tells you after 300 secs that there were no free connections in the pool, so it can't give you one. 因此,它不会使“所有线程都挂起”,它只会在300秒后告诉您池中没有空闲连接,所以它不能给你一个。

The parameter governing how long an transaction may stay active is called transaction timeout , after which the transaction is marked for rollback. 管理事务可以保持活动多长时间的参数称为事务超时 ,之后事务被标记为回滚。 But even this timeout does not cancel out the thread using the connection, it only marks it as rollback-only. 但即使这个超时也没有取消使用该连接的线程,它只将其标记为仅回滚。 In order to free connection you must use either use a third party tool (ITCAM can cancel any threads in the server), or terminate/drop connections from database side. 为了释放连接,您必须使用第三方工具(ITCAM可以取消服务器中的任何线程),或终止/删除数据库端的连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM