[ https://issues.apache.org/jira/browse/QPID-5787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14008935#comment-14008935 ]
Keith Wall commented on QPID-5787: ---------------------------------- Hi Rob, I have two ideas to solve this problem: # We change the automatically generated CO factories so they have responsibility for calling #registerChild, and/or # We impose a rule that objects cannot be observed before they are open. I think my preference is for the first - owing to its simplify. It does mean that ACO#registerChild will have to become public. > Management can observe a child object before its constructor has completed > -------------------------------------------------------------------------- > > Key: QPID-5787 > URL: https://issues.apache.org/jira/browse/QPID-5787 > Project: Qpid > Issue Type: Bug > Components: Java Broker > Affects Versions: 0.29 > Reporter: Keith Wall > Assignee: Rob Godfrey > > Currently new ConfiguredObjects register themselves within their parent > within the constructor (ACO constructor's invocation of registerChild - line > 243). > This allows *this* to escape before the object has completed its constructor. > A client calling parent.getChildren is able to see partly constructed > children (DEFECT). > This problem is revealed by a sporadic test failure - > BDBHAVirtualHostNodeRestTest. The REST API tries to query virtual host node > whose child is still undergoing construction. This leads to a NPE in the > Broker logs and a 500 back to the http agent. > In this case, the VH's statistics fields are final and initialised once > during AVH's constructor. > {noformat} > Broker-Configuration-Thread 2014-05-26 11:04:05,038 INFO > [qpid.server.stats.StatisticsCounter] Resetting statistics for counter: > bytes-received-BDBHAVirtualHostNodeRestTest.testNewMasterElectedWhenVirtualHostIsStopped-28 > qtp1754689051-872 2014-05-26 11:04:05,039 WARN > [eclipse.jetty.servlet.ServletHandler] /api/latest/virtualhostnode/node3 > java.lang.NullPointerException > at > org.apache.qpid.server.virtualhost.AbstractVirtualHost.getBytesIn(AbstractVirtualHost.java:1175) > at sun.reflect.GeneratedMethodAccessor46.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.apache.qpid.server.model.ConfiguredObjectAttributeOrStatistic.getValue(ConfiguredObjectAttributeOrStatistic.java:138) > at > org.apache.qpid.server.model.AbstractConfiguredObject.getStatistics(AbstractConfiguredObject.java:1296) > at > org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.incorporateStatisticsIntoMap(ConfiguredObjectToMapConverter.java:89) > at > org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.convertObjectToMap(ConfiguredObjectToMapConverter.java:42) > at > org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.incorporateChildrenIntoMap(ConfiguredObjectToMapConverter.java:112) > at > org.apache.qpid.server.management.plugin.servlet.rest.ConfiguredObjectToMapConverter.convertObjectToMap(ConfiguredObjectToMapConverter.java:46) > at > org.apache.qpid.server.management.plugin.servlet.rest.RestServlet.doGetWithSubjectAndActor(RestServlet.java:318) > at > org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet$1.run(AbstractServlet.java:76) > at > org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet$1.run(AbstractServlet.java:72) > at java.security.AccessController.doPrivileged(Native Method) > at javax.security.auth.Subject.doAs(Subject.java:415) > at > org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet.doWithSubjectAndActor(AbstractServlet.java:195) > at > org.apache.qpid.server.management.plugin.servlet.rest.AbstractServlet.doGet(AbstractServlet.java:70) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:575) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) > at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1496) > at > org.apache.qpid.server.management.plugin.filter.ForbiddingAuthorisationFilter.doFilter(ForbiddingAuthorisationFilter.java:90) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1467) > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) > at org.eclipse.jetty.server.Server.handle(Server.java:370) > at > org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494) > at > org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971) > at > org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033) > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:644) > at > org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235) > at > org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:667) > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) > at java.lang.Thread.run(Thread.java:744) > > {noformat} -- This message was sent by Atlassian JIRA (v6.2#6252) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org