synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hiranya Jayathilaka (JIRA)" <j...@apache.org>
Subject [jira] Commented: (SYNAPSE-659) MBeanRegistrar Is Not Thread Safe
Date Wed, 09 Jun 2010 06:37:11 GMT

    [ https://issues.apache.org/jira/browse/SYNAPSE-659?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12876976#action_12876976
] 

Hiranya Jayathilaka commented on SYNAPSE-659:
---------------------------------------------

Just had another look at the design and it seems the race condition can occur only when registering
the statistics MBean. All other MBeans (endpoints, server management, datasources etc) are
registered by single thread instances. So we can just synchronize the invocation in the StatisticsCollector
class.

> MBeanRegistrar Is Not Thread Safe
> ---------------------------------
>
>                 Key: SYNAPSE-659
>                 URL: https://issues.apache.org/jira/browse/SYNAPSE-659
>             Project: Synapse
>          Issue Type: Bug
>    Affects Versions: 1.2
>            Reporter: Hiranya Jayathilaka
>            Assignee: Hiranya Jayathilaka
>             Fix For: 2.0
>
>
> The MBeanRegistrar implementation used to register various MBeans, is not thread safe.
The register method can be invoked by multiple threads at the same time with the same arguments.With
a sufficient level of contention, the registrar may attempt to register the same MBean multiple
times. This results in an exception like this:
> [2010-06-09 11:28:56,840]  WARN - MBeanRegistrar Error registering a MBean with name
' StatisticsView ' and category name ' StatisticsView' for JMX management
> javax.management.InstanceAlreadyExistsException: org.apache.synapse:Type=StatisticsView,Name=StatisticsView
> 	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
> 	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
> 	at org.apache.synapse.commons.jmx.MBeanRegistrar.registerMBean(MBeanRegistrar.java:51)
> 	at org.apache.synapse.aspects.statistics.StatisticsCollector.<init>(StatisticsCollector.java:36)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.collectStatistics(StatisticsReporter.java:192)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.reportForComponent(StatisticsReporter.java:56)
> 	at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:75)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178)
> 	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:349)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:239)
> 	at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> [2010-06-09 11:28:56,840]  WARN - MBeanRegistrar Error registering a MBean with name
' StatisticsView ' and category name ' StatisticsView' for JMX management
> javax.management.InstanceAlreadyExistsException: org.apache.synapse:Type=StatisticsView,Name=StatisticsView
> 	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
> 	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
> 	at org.apache.synapse.commons.jmx.MBeanRegistrar.registerMBean(MBeanRegistrar.java:51)
> 	at org.apache.synapse.aspects.statistics.StatisticsCollector.<init>(StatisticsCollector.java:36)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.collectStatistics(StatisticsReporter.java:192)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.reportForComponent(StatisticsReporter.java:56)
> 	at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:75)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178)
> 	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:349)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:239)
> 	at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> [2010-06-09 11:28:56,840]  WARN - MBeanRegistrar Error registering a MBean with name
' StatisticsView ' and category name ' StatisticsView' for JMX management
> javax.management.InstanceAlreadyExistsException: org.apache.synapse:Type=StatisticsView,Name=StatisticsView
> 	at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.internal_addObject(DefaultMBeanServerInterceptor.java:1484)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:917)
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:312)
> 	at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:482)
> 	at org.apache.synapse.commons.jmx.MBeanRegistrar.registerMBean(MBeanRegistrar.java:51)
> 	at org.apache.synapse.aspects.statistics.StatisticsCollector.<init>(StatisticsCollector.java:36)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.collectStatistics(StatisticsReporter.java:192)
> 	at org.apache.synapse.aspects.statistics.StatisticsReporter.reportForComponent(StatisticsReporter.java:56)
> 	at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:75)
> 	at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178)
> 	at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:349)
> 	at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:239)
> 	at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:58)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> [2010-06-09 11:28:56,840]  WARN - MBeanRegistrar Error registering a MBean with name
' StatisticsView ' and category name ' StatisticsView' for JMX management
> In this case I engaged statistics on an endpoint and then loaded the ESB with Java bench
using 30 concurrent threads.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message