commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arun Karthik <ARavishan...@livevox.com>
Subject RE: [dbcp] GenericObjectPool.borrowObject() hangs
Date Thu, 19 Mar 2009 16:45:16 GMT
Hi Phil Steitz,

Thank you for your input.
I checked the quartz source code that implements ConnectionProvider. It's called PoolingConnectionProvider
(attached) and it sets basic properties

        datasource = new BasicDataSource();
        datasource.setDriverClassName(dbDriver);
        datasource.setUrl(dbURL);
        datasource.setUsername(dbUser);
        datasource.setPassword(dbPassword);
        datasource.setMaxActive(maxConnections);
        if (dbValidationQuery != null) {
            datasource.setValidationQuery(dbValidationQuery);
        }

Nothing more. In your below email, when you mentioned that it should have handled SQLException,
I would like to know where exactly do you mean? Is it in the getConnection() method, or some
other place?

Regards,
Arun
-----Original Message-----
From: Phil Steitz [mailto:phil.steitz@gmail.com] 
Sent: Wednesday, March 18, 2009 4:44 AM
To: Commons Users List
Subject: Re: [dbcp] GenericObjectPool.borrowObject() hangs

Arun Karthik wrote:
> Hi Phil Steitz,
>
> I see that all threads are either BLOCKED or IN_NATIVE. I am attaching the entire jstack
output.
>
> I set these parameters:
>
> maxActive: 5
> validationQuery: select 1 from dual
>
> We don't set the following props (actually we have no way of setting this, Quartz sets
these value, and it does not set this value):
> maxWait
> testOnBorrow
> testOnReturn
> maxIdle
> minEvictableIdleTimeMillis
> testWhileIdle
> timeBetweenEvictionRunsMillis
> testWhileIdle 
>   
Sorry for the slow response on this.  From the dump and your config, it 
looks like the pool is exhausted but client threads holding the dbcp 
connections are gone.  This could happen if  the client code (I guess 
quartz) does not handle the exceptions generated when the physical 
connections are closed on the server side when the database goes down 
for maintenance.  Client code using dbcp should close dbcp connections 
in finally blocks to avoid abandoning them when exceptions arise.  This 
needs to happen even when the physical connections are closed on the 
server side.  Unless you either always close the dbcp wrappers or enable 
abandoned connection cleanup (removeAbandoned), you risk depleting the 
pool.  Are you sure your / quartz' code is closing dbcp connections on 
all control paths?

Phil
> Arun Karthik Ravishankar
> -----Original Message-----
> From: Phil Steitz [mailto:phil.steitz@gmail.com] 
> Sent: Friday, March 06, 2009 8:08 AM
> To: Commons Users List
> Subject: Re: [dbcp] GenericObjectPool.borrowObject() hangs
>
> Arun Karthik wrote:
>   
>> Hi,
>>
>> Occasionally when the DB is taken down for maintenance my server hangs with jmap
similar to below:
>> I am not able to reproduce the same when I try to unplug the DB machine's network
cable or any other way I could think ok.
>> Could someone please guide me as to what the problem may  be.
>>   
>>     
>
> Can you provide the pool configuration settings - maxActive, maxWait, 
> testOnBorrow, etc.?   Also, are you sure *all* of the threads are 
> blocked in this state.  From the line numbers in the trace, it looks 
> like you have maxWait set to a negative value, meaning that threads will 
> block indefinitely waiting for connections to become available.  The 
> thread in the dump below is doing that - waiting for a connection to 
> become available.  
>
> Phil
>   
>> I am using
>>
>> 1.       quartz scheduler
>>
>> 2.       commons-dbcp-1.2.1
>>
>> 3.       commons-pool-1.2
>>
>> 4.       Oracle RAC DB with thin client
>>
>> 5.       ojdbc14.jar
>>
>> The Quartz Scheduler internally creates a Connection Pool and uses the connection
details like URL, UserID, PWD and maxConnections, and validateQuery parameters/settings
>>
>> org.quartz.dataSource.lclDS.URL=jdbc:oracle:thin:@dbsrv:1521:XE
>> org.quartz.dataSource.lclDS.user=uname
>> org.quartz.dataSource.lclDS.password=pwd
>> org.quartz.dataSource.lclDS.driver=oracle.jdbc.OracleDriver
>> org.quartz.dataSource.lclDS.maxConnections=1
>> org.quartz.dataSource.lclDS.validationQuery=select 1 from dual
>>
>> ---------------------------------------- thread dump--------------------------------------------------
>> Thread 19804: (state = BLOCKED)
>>  - java.lang.Object.wait(long) @bci=0 (Compiled frame; information may be imprecise)
>>  - java.lang.Object.wait() @bci=2, line=485 (Interpreted frame)
>>  - org.apache.commons.pool.impl.GenericObjectPool.borrowObject() @bci=121, line=748
(Interpreted frame)
>>  - org.apache.commons.dbcp.PoolingDataSource.getConnection() @bci=4, line=95 (Interpreted
frame)
>>  - org.apache.commons.dbcp.BasicDataSource.getConnection() @bci=4, line=540 (Interpreted
frame)
>>  - org.quartz.utils.PoolingConnectionProvider.getConnection() @bci=4, line=197 (Interpreted
frame)
>>  - org.quartz.utils.DBConnectionManager.getConnection(java.lang.String) @bci=49,
line=112 (Interpreted frame)
>>  - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getDBConnection() @bci=6, line=291 (Interpreted
frame)
>>  - com.abcd.jobs.utils.ABCDJobSchedulerUtil.getJobs(javax.servlet.http.HttpServletRequest)
@bci=35, line=306 (Interpreted frame)
>>  - org.apache.jsp.jobs_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
@bci=121, line=110 (Interpreted frame)
>>  - org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame)
>>  - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
@bci=30, line=803 (Interpreted frame)
>>  - org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, boolean) @bci=395, line=393 (Interpreted frame)
>>  - org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=134,
line=320 (Interpreted frame)
>>  - org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletResponse) @bci=436, line=266 (Interpreted frame)
>>  - javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse)
@bci=30, line=803 (Interpreted frame)
>>  - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) @bci=374, line=290 (Interpreted frame)
>>  - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame)
>>  - com.abcd.jobs.filters.SessionCheckFilter.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=179, line=87 (Interpreted frame)
>>  - org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) @bci=117, line=235 (Interpreted frame)
>>  - org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest,
javax.servlet.ServletResponse) @bci=101, line=206 (Interpreted frame)
>>  - org.apache.catalina.core.StandardWrapperValve.invoke(org.apache.catalina.connector.Request,
org.apache.catalina.connector.Response) @bci=804, line=233 (Interpreted frame)
>>  - org.apache.catalina.core.StandardContextValve.invoke(org.apache.catalina.connector.Request,
org.apache.catalina.connector.Response) @bci=285, line=175 (Interpreted frame)
>>  - org.apache.catalina.core.StandardHostValve.invoke(org.apache.catalina.connector.Request,
org.apache.catalina.connector.Response) @bci=64, line=128 (Interpreted frame)
>>  - org.apache.catalina.valves.ErrorReportValve.invoke(org.apache.catalina.connector.Request,
org.apache.catalina.connector.Response) @bci=6, line=102 (Interpreted frame)
>>  - org.apache.catalina.core.StandardEngineValve.invoke(org.apache.catalina.connector.Request,
org.apache.catalina.connector.Response) @bci=42, line=109 (Interpreted frame)
>>  - org.apache.catalina.connector.CoyoteAdapter.service(org.apache.coyote.Request,
org.apache.coyote.Response) @bci=157, line=263 (Interpreted frame)
>>  - org.apache.coyote.http11.Http11Processor.process(java.net.Socket) @bci=432, line=844
(Interpreted frame)
>>  - org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(java.net.Socket)
@bci=82, line=584 (Interpreted frame)
>>  - org.apache.tomcat.util.net.JIoEndpoint$Worker.run() @bci=41, line=447 (Interpreted
frame)
>>  - java.lang.Thread.run() @bci=11, line=619 (Interpreted frame)
>>
>> Regards,
>> Arun
>>
>>
>>
>>
>>   
>>     
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org



Mime
View raw message