commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "simon.kitching@chello.at" <simon.kitch...@chello.at>
Subject Re: [dbcp] Contention for DriverManager when initializing multiple datasources WAS: Re: dbcp blocked on webapp startup
Date Tue, 01 Jul 2008 13:06:28 GMT
Adrian Woodhead schrieb:
> Simon - thanks for your feedback, what you said makes sense...
>>> The big question is: why are you running dbcp concurrently in two 
>>> different
>>> threads?
>>>     
>>
>> Two data sources within the same webapp (spring config) perhaps?
>>   
> Exactly. There are 3 actually - 2 postgres databases and one mysql 
> database, each has its own pooled datasource.

But if all the pools are initialised via Spring, and are all non-lazy 
then they should be initialised sequentially by the same spring 
initialisation thread, not in parallel. Spring initialisation is done 
via a servlet ContextListener, and that is guaranteed to be called 
single-threaded.

But in the thread-dumps, we clearly see two threads doing driver loading 
in parallel.

Presumably some of these pooled datasources are not spring-managed?
>
>>> Possibly dbcp should call DriverManager.getDrivers() internally on 
>>> startup
>>> to avoid this race...
>>>     
>>
>> If this would solve it, I'd say it's a must, then.  This is a really
>> nasty race condition.
>>   
> It is. Should I file a bug? I'd be happy to try out a build with this 
> fix in it to see if it helps.

Yes, I would suggest filing a bugreport.

Cheers,
Simon


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


Mime
View raw message