cancel
Showing results for 
Search instead for 
Did you mean: 

Pile up of waiting threads in my SAP JMX client

Former Member
0 Kudos

Hello All,

I seem to have a thread leak issue in my SAP JMX Client which uses RMI P4 protocol to connect to my AS JAVA server. I use my java application (JMX Client) to get the JMX data which I see using Netweaver Administrator. For this purpose, every 5 minutes,  I get an MBeanServerConnection object as shown in the following SAP help page :

http://help.sap.com/saphelp_nw04/helpdata/en/64/617cfb94845d468b0498b4b2c53d74/content.htm

After getting the JMX data, I simply set the MBeanServerConnection variable to null as there seems to be no way to 'close' this JMX connection.

This, however, seems to keep creating a lot of threads in the 'waiting' state. I can see this using the jconsole application. These threads have a stack trace similar to the following stack trace :

> Name: Thread-51

> State: WAITING on com.sap.engine.services.rmi_p4.DispatchImpl@1e6cf07

> Total blocked: 84  Total waited: 85

> Stack trace:

> java.lang.Object.wait(Native Method)

> java.lang.Object.wait(Object.java:485)

> com.sap.engine.services.rmi_p4.DispatchImpl.run(DispatchImpl.java:602)

> java.lang.Thread.run(Unknown Source)

This issue seems to be the cause for my production server crash by creating more than 1000 such waiting threads over a period of time. Even in my development server, with no load, about 10 new waiting threads have been added in a period of 90 minutes and the waiting threads are always in waiting state and never go away thereby causing a pile up.

Do you know of a fix for this? Is there any SAP note I can refer to for this? Could this issue be due to periodically getting MBeanServerConnection objects? If so, could I just create an MBeanServerConnection object once and reuse it every 5 minutes?

Please advise. Thank you verhy much

-Regards,

Arvind

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Arvind,

Please have a look at this link -

http://help.sap.com/saphelp_nw04/helpdata/en/64/617cfb94845d468b0498b4b2c53d74/frameset.htm

This link gives details about administration of Adapter service. This way your need to manually modify MBeanServerConnection properties will go away which is the cause of waiting threads.

Hope this helps,

Regards,

Ashutosh

Former Member
0 Kudos

Hi Ashutosh,

Thanks for your reply. We are also facing the same issue.

We use External JMX connection as suggested in the link that you have suggested.

But Still we  see the waiting threads growing over time.

Stack trace:

> java.lang.Object.wait(Native Method)

> java.lang.Object.wait(Object.java:485)

> com.sap.engine.services.rmi_p4.DispatchImpl.run(DispatchImpl.java:602)

> java.lang.Thread.run(Unknown Source)

//
set the connection properties for the RMI-P4 connection

Properties
connectionProperties = new
Properties();

  1. connectionProperties.setProperty(Context.INITIAL_CONTEXT_FACTORY,

              
"com.sap.engine.services.jndi.InitialContextFactoryImpl");

  1. connectionProperties.setProperty(Context.PROVIDER_URL, "<host-name>:<p4-port>");
  2. connectionProperties.setProperty(Context.SECURITY_PRINCIPAL,
    "<user-name>");
  3. connectionProperties.setProperty(Context.SECURITY_CREDENTIALS,
    "<password>");

//
create the MBeanServerConnection

MBeanServerConnection mbsc = JmxConnectionFactory.getMBeanServerConnection(JmxConnectionFactory.
PROTOCOL_ENGINE_P4,

connectionProperties);

Thanks

Hari