[ https://issues.apache.org/jira/browse/CLOUDSTACK-6472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13977948#comment-13977948 ]
Pierre-Yves Ritschard commented on CLOUDSTACK-6472: --------------------------------------------------- Here is the relevant stacktrace: 2014-04-22 00:18:07,417 ERROR [cloud.api.ApiServer] (catalina-exec-2:ctx-60c87510 ctx-22de212f ctx-a88a3dd7) unhandled exception executing api command: listUsageRecords java.lang.NullPointerException at com.cloud.api.ApiResponseHelper.createUsageResponse(ApiResponseHelper.java:3308) at org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd.execute(GetUsageRecordsCmd.java:119) at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:161) at com.cloud.api.ApiServer.queueCommand(ApiServer.java:531) at com.cloud.api.ApiServer.handleRequest(ApiServer.java:374) at com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:323) at com.cloud.api.ApiServlet.access$000(ApiServlet.java:53) at com.cloud.api.ApiServlet$1.run(ApiServlet.java:115) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext$1.call(DefaultManagedContext.java:56) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.callWithContext(DefaultManagedContext.java:103) at org.apache.cloudstack.managed.context.impl.DefaultManagedContext.runWithContext(DefaultManagedContext.java:53) at com.cloud.api.ApiServlet.processRequest(ApiServlet.java:112) at com.cloud.api.ApiServlet.doGet(ApiServlet.java:74) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:615) at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:647) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:889) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:744) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:2282) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:744) > GenerateUsageRecords generates NPEs for expunging instances > ----------------------------------------------------------- > > Key: CLOUDSTACK-6472 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-6472 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Management Server, Usage > Affects Versions: 4.3.0 > Environment: linux > Reporter: Pierre-Yves Ritschard > Attachments: 0001-handle-removed-entities.patch > > > The GenerateUsageRecords API command, pulls down the list of usage records in > the cloud_usage database and augments records with information pulled from > the cloud database. > When dealing with instance records, only instances which are do not have a > value for the removed field are considered. Unfortunately, since the output > of _entityMgr.findById is not checked this means that Null Pointer Exceptions > are generated when trying to access the output for expunged VMs. > The attached patch fixes the issue and applies a similar fix for other > similar cases. -- This message was sent by Atlassian JIRA (v6.2#6252)