Wednesday 11 March 2015

1 Managed connections are already being used on this thread.

Hello everyone,

Today it was the below error in my WAS 7.0.017 ND environment..

[3/10/15 16:34:13:185 EDT] 000000cb PoolManager   W   Exceeded the number of allowable managed connection on thread 000000cb.  1 managed connections are already being used on this thread.    Managed connection being used on this thread 
MCWrapper id 1462303  Managed connection org.apache.activemq.ra.ActiveMQManagedConnection@1a4bf8a State:STATE_TRAN_WRAPPER_INUSE Thread Id: 000000cb Thread Name: WebContainer : 0 Handle count 0
     Start time inuse Tue Mar 10 16:34:13 EDT 2015 Time inuse 0 (seconds)
     Last allocation time Tue Mar 10 16:34:13 EDT 2015
     getConnection stack trace information:   org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
          org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)
          org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456)
          org.springframework.jms.core.JmsTemplate.send(JmsTemplate.java:534)
          org.springframework.jms.core.JmsTemplate.convertAndSend(JmsTemplate.java:612)

This as unexpected error occurred in my  SystemOut.log and at the same time my application performance was on it's worst. When I look for the error on google I found the one solution frequently for this  error and logically I think this is correct. I didn't implement this solution because in my case it resolved by the different thing. But here I am going to share the both things with you. The first one which I applied and second may also helps you.

1. Change Log Level:

The solution in my case was that I had to change/reduce the trace level of the AppServer back to *info from *finest , as the server was too busy writing logs besides serving a database connection request.

2. Increase maxNumberOfMCsAllowableInThread parameter for DataSource:

As in error it is showing that 1 managed connections are already being used on this thread means there is only one managed connection is allowed on each thread and it's in used now. But there may be scenario when the application is designed such that web layer (controller) makes database calls (read only) in addition to database calls (Read/Write) at the service layer in such a scenario we would assume we would have more than one connection involved per thread. So then the question is, is it possible to configure the WAS to increase the allowed size of managed connection to more than 1. And the answer is yes we can increase it using the below steps

Procedure:

Go to Data sources > DataSource_Name >Connection pools > Custom properties > New Create the new custom pool property  maxNumberOfMCsAllowableInThread setting it to the value you wish, In our case we set it to the 10.



Click on Apply and Save.

This worked in my case, hope will work for you also. Kindly comment for your suggestion and quires.  

"Effort only fully releases its reward after a person refuses to quit.”

 Regards,
 Akhilesh B. Humbe

No comments:

Post a Comment

Popular Posts