On Apr 8, 2014, at 8:22 AM, Saurabh Saraswat <ssaras...@pivotalindia.com> wrote:

> Dear Dan,
> 
> Thanks for taking time to respond me.
> 
> My updated Resource Tag is -
> 
> <Resource name="jdbc/MaxDB" auth="Container" type="javax.sql.DataSource"
>               maxActive="100" maxIdle=“30"

As Chris mentioned, set maxActive 1 in your dev environment.  That will help 
you find the problem more quickly.

> maxWait="10000"
>               username="usrname" password="password"
> driverClassName="com.mysql.jdbc.Driver"
> 
> url="jdbc:MySQL://localhost:3306/MaxDB?zeroDateTimeBehavior=convertToNull"
>               validationQuery="Select 1" removeAbandoned="true"
> removeAbandonedTimeout=“1000"

This is in seconds, so 1000 is 16.667 minutes, and is probably way to high.  
For the purposes of debugging, try something much lower like 10 seconds.  That 
way you’ll get feedback quick feedback.

>               logAbandoned="false”/>

Set this to true, otherwise you’re not going to know when it detects an 
abandoned connection.

> 
> I have also cross checked my code. I am closing the connection properly in
> finally block.

If you have not done so already, run something like FindBugs on your code.

> Also have set the max_connection=250 in etc/my.cnf for MySql.
> 
> Even now i am not getting any Exception but my Application gets Hanged
> after a certain time (after Certain hits to the database from application).
> Have tested pooling with different ways like after setting -
> factory="org.apache.tomcat.jdbc.pool.DataSourceFactory".
> 
> Conclusion is that i am not able to find satisfactory solution.

Try the changes above and take some thread dumps.  I think that will get you 
pointed in the right direction.

Dan

> 
> Thanking You!
> 
> *Best Regards,    *
> 
> *Saurabh Sarasvat*
> 
> 
> 
> 
> On Tue, Apr 8, 2014 at 5:26 PM, Daniel Mikusa <dmik...@gopivotal.com> wrote:
> 
>> On Apr 8, 2014, at 5:46 AM, Saurabh Saraswat <ssaras...@pivotalindia.com>
>> wrote:
>> 
>>> On Fri, Apr 4, 2014 at 8:39 PM, Christopher Schultz <
>>> ch...@christopherschultz.net> wrote:
>>> 
>>>> -----BEGIN PGP SIGNED MESSAGE-----
>>>> Hash: SHA256
>>>> 
>>>> Daniel,
>>>> 
>>>> On 4/4/14, 8:57 AM, Daniel Mikusa wrote:
>>>>> On Apr 4, 2014, at 8:22 AM, Saurabh Saraswat
>>>>> <ssaras...@pivotalindia.com> wrote:
>>>>> 
>>>>>> Dear Dan,
>>>>>> 
>>>>>> Thanks for your response!
>>>>>> 
>>>>>> I have cross checked the user / password configuration. All is
>>>>>> correct.
>>>>> 
>>>>> If you're getting "Access Denied" exceptions, there is only one
>>>>> cause and that's bad credentials (or host + credentials, because
>>>>> MySQL can limit access based on the host).  If you're not seeing
>>>>> these any more then, disregard.
>>>> 
>>>> I've never tried this, but it could also be due to connection-limits
>>>> on the server itself. Having "root" limited to a certain number of
>>>> connections sounds like a terrible idea, but then again, so does
>>>> connecting as root in the first place.
>>>> 
>>>>>> As i mentioned that initially i am getting the object of
>>>>>> connection but after some time (After few hits to database from
>>>>>> application) my web app goes to slow and than it stops working i
>>>>>> i got the below exception-
>>>>>> *org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a
>>>>>> connection, pool error Timeout waiting for idle object*
>>>>> 
>>>>> +1 to David's suggestion.  You could be leaking connections or your
>>>>> queries are very slow.
>>>> 
>>>> +1
>>>> 
>>>>> Two suggestions:
>>>>> 
>>>>> 1.) Enable the slow query log on your MySQL server and see if the
>>>>> queries are slow.  Alternatively, login to your MySQL server and
>>>>> run 'show processlist".  That will show you what queries are
>>>>> running.
>>>> 
>>>> +1
>>>> 
>>>>> 2.) Enable DBCP's abandoned connection detection.  See the
>>>>> "removeAbandoned" attribute.
>>>> 
>>>> +10
>>>> 
>>>>> With this (and logAbandoned), the pool will alert you when your
>>>>> application does not properly return connections to the pool.
>>>> 
>>>> In development, I always recommend that you use maxActive="1" for your
>>>> connection pools. This will expose any potential deadlocks you may
>>>> have mistakenly coded into your application.
>>>> 
>>>> - -chris
>>>> -----BEGIN PGP SIGNATURE-----
>>>> Version: GnuPG v1
>>>> Comment: GPGTools - http://gpgtools.org
>>>> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>>>> 
>>>> iQIcBAEBCAAGBQJTPssiAAoJEBzwKT+lPKRYTx4QAK8a4WJIx1i+yWyZquSrCnad
>>>> RBNB69jnPmYG0Uzc/yKyHzOXvv2wt1vE22wYyp64b4FFVqQNBmEnnm6XI20PSR2i
>>>> Yt9lm5wZ5/5fsCGvj39B8E11GCao5enzkhXUpa51spLnjHfw5k3o0gGmWAqhLVza
>>>> nOfbG+rTjjjXCrr1Y6tz0g+35M+w02TIh87Z5xdkvboqv/NRfxbGKRIZB2e1zT0K
>>>> USY4skgug3L1TpKiXgoRNv7g7gbxHB7AXgL1po+PI1T1mNXCakUE81O26Etv/wm2
>>>> 1A/d15LfCLou0uWQSfHPqaoODGFVOTsRWwn8xiJdjo2Ah/y7OqXfzMQh41UBO8H7
>>>> jNmakIHlb6NYDJK6LiRFlGw5K9AEO+dNFJ9e6Gi4kELB4Kn6CGqFRD3aqTsVerOb
>>>> EhEG844nDmVRzr7gwK58aXSICy8PURDOfmZ+IaXehz0MARnKQiog3cWBT+EKIHxq
>>>> RUAc0T/YEG+Qm1jiZef5h+NuMZLrzczQIOXXGYkjcMwGcUxmjzBbbvYbr56g84jL
>>>> 3ukIXp6bnOvyIdB8jnibbICoR/sj0Mg4zia7vTPkqdXbU3Ng2W6/lV9K2Mnm9aDL
>>>> OcLocnWnFGZycukIDYtfbtZOY7wTAqk5fJsZauDQGeeA4M9UXu4dPgpaoahuK8Dq
>>>> moJwtEq/5/JNXkctdS7n
>>>> =RI4v
>>>> -----END PGP SIGNATURE-----
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>>>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>>> 
>>>> 
>>> All,
>>> 
>>> I have tested with configurations suggested by all of you.I am not
>> getting
>>> exceptions now but still after certain time, the server gets hanged.
>>> 
>>> Any suggestion please,still not able to rid out of this issue.
>>> 
>>> Saurabh
>> 
>> 1.) Include your updated Resource tag.  We'll want to see what you're
>> working with now.
>> 
>> 2.) When the server 'hangs', take some thread dumps and see what it's
>> doing.  That will hopefully provide more information about what the server
>> is doing at the time.
>> 
>> 
>> http://wiki.apache.org/tomcat/HowTo#How_do_I_obtain_a_thread_dump_of_my_running_webapp_.3F
>> 
>> Dan
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to