[ https://issues.apache.org/jira/browse/CLOUDSTACK-9380?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15301409#comment-15301409 ]
ASF subversion and git services commented on CLOUDSTACK-9380: ------------------------------------------------------------- Commit 550aabb3082e2df4787ada8904f67b086213db09 in cloudstack's branch refs/heads/master from [~williamstev...@gmail.com] [ https://git-wip-us.apache.org/repos/asf?p=cloudstack.git;h=550aabb ] Merge pull request #1550 from ustcweizhou/CLOUDSTACK-9380-listDomains-NPE CLOUDSTACK-9380: fix NPE in listDomains API for a mistakeThe issue happens if volumeTotal is NULL in database. This is caused by commit 0407fb334f3a79f570217f35636b47076b06d500 for CLOUDSTACK-7847. * pr/1550: CLOUDSTACK-9380: fix NPE in listDomains API for a mistake Signed-off-by: Will Stevens <williamstev...@gmail.com> > listDomains API returns NPE if there is a failure in deleting domains > --------------------------------------------------------------------- > > Key: CLOUDSTACK-9380 > URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9380 > Project: CloudStack > Issue Type: Bug > Security Level: Public(Anyone can view this level - this is the > default.) > Components: Management Server > Affects Versions: 4.9.0 > Environment: Latest build from master > Reporter: Sanjeev N > Priority: Critical > Attachments: cloud.sql, vmops.log > > > listDomains API returns NPE if there is a failure in deleting domains > Steps to Reproduce: > ================ > 1.Create few domains under root domain and create one or two accounts in each > domain > 2.Create few vms, volumes, snapshots with those accounts. > 3.Now delete the domains and for one of the domains simulate the domain > deletion failure > 4.Try to list the domains using listDomains api without any domain id paramter > Result: > ====== > listDomains API returns error code 530 and in the management server log we > see following NPE: > 2016-05-16 08:53:09,273 ERROR [c.c.a.ApiServer] > (qtp237306958-12297:ctx-8f28bbf4 ctx-fdb614d0 ctx-6466fb85) (logid:d17482a8) > unhandled exception executing api command: [Ljava.lang.String;@652d471e > java.lang.NullPointerException > at > com.cloud.api.query.dao.DomainJoinDaoImpl.setResourceLimits(DomainJoinDaoImpl.java:113) > at > com.cloud.api.query.dao.DomainJoinDaoImpl.newDomainResponse(DomainJoinDaoImpl.java:76) > at sun.reflect.GeneratedMethodAccessor351.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150) > at > com.cloud.utils.db.TransactionContextInterceptor.invoke(TransactionContextInterceptor.java:34) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161) > at > org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91) > at > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) > at > org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) > at com.sun.proxy.$Proxy272.newDomainResponse(Unknown Source) > at com.cloud.api.ApiDBUtils.newDomainResponse(ApiDBUtils.java:1834) > at > com.cloud.api.query.ViewResponseHelper.createDomainResponse(ViewResponseHelper.java:354) > at > com.cloud.api.query.QueryManagerImpl.searchForDomains(QueryManagerImpl.java:1880) > at > org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd.execute(ListDomainsCmd.java:87) > at com.cloud.api.ApiDispatcher.dispatch(ApiDispatcher.java:150) > at com.cloud.api.ApiServer.queueCommand(ApiServer.java:705) > at com.cloud.api.ApiServer.handleRequest(ApiServer.java:529) > at > com.cloud.api.ApiServlet.processRequestInContext(ApiServlet.java:299) > at com.cloud.api.ApiServlet$1.run(ApiServlet.java:129) > 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:126) > at com.cloud.api.ApiServlet.doGet(ApiServlet.java:88) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) > at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) > at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) > at > org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) > at > org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) > at org.eclipse.jetty.server.Server.handle(Server.java:499) > at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) > at > org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) > at > org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) > at > org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) > at java.lang.Thread.run(Thread.java:744) > 2016-05-16 08:53:09,276 DEBUG [c.c.a.ApiServlet] > (qtp237306958-12297:ctx-8f28bbf4 ctx-fdb614d0 ctx-6466fb85) (logid:d17482a8) > ===END=== 172.16.88.7 -- GET > apiKey=I1Vj6dA8tmVTJopVVZlgR7y6LU92d_AeUaXxbdbZhpJgu4BJ2MpfWD2xE2b8ZYd70qPA10_rDYucnQVmHNJHZw&command=listDomains&signature=gfujxqFCCJZHbDVx%2Bm8VsakdE4g%3D&response=json > Observations: > ============ > When there was a failure in deleting the domain, resouce_count table didn't > have any entries for that domain id. So count filed for all the resources in > domain_view table was set to NULL. This could be the reason for listDomains > to return NPE. > mysql> select * from domain where id=70; > +----+--------+-----------+--------------------------------------+-------+-------------+-------+-------------+----------------+---------+--------+----------------+--------+ > | id | parent | name | uuid | owner | > path | level | child_count | next_child_seq | removed | state | > network_domain | type | > +----+--------+-----------+--------------------------------------+-------+-------------+-------+-------------+----------------+---------+--------+----------------+--------+ > | 70 | 1 | D1-UE6QW6 | 612da7a8-0bff-4792-9dcd-08d14d19515b | 2 | > /D1-UE6QW6/ | 1 | 1 | 3 | NULL | Active | NULL > | Normal | > +----+--------+-----------+--------------------------------------+-------+-------------+-------+-------------+----------------+---------+--------+----------------+--------+ > 1 row in set (0.00 sec) > mysql> select * from domain_view where id=70\G > *************************** 1. row *************************** > id: 70 > parent: 1 > name: D1-UE6QW6 > uuid: 612da7a8-0bff-4792-9dcd-08d14d19515b > owner: 2 > path: /D1-UE6QW6/ > level: 1 > child_count: 1 > next_child_seq: 3 > removed: NULL > state: Active > network_domain: NULL > type: Normal > vmLimit: NULL > vmTotal: NULL > ipLimit: NULL > ipTotal: NULL > volumeLimit: NULL > volumeTotal: NULL > snapshotLimit: NULL > snapshotTotal: NULL > templateLimit: NULL > templateTotal: NULL > vpcLimit: NULL > vpcTotal: NULL > projectLimit: NULL > projectTotal: NULL > networkLimit: NULL > networkTotal: NULL > cpuLimit: NULL > cpuTotal: NULL > memoryLimit: NULL > memoryTotal: NULL > primaryStorageLimit: NULL > primaryStorageTotal: NULL > secondaryStorageLimit: NULL > secondaryStorageTotal: NULL > 1 row in set (0.00 sec) > mysql> select * from resource_count where domain_id=70; > Empty set (0.00 sec) -- This message was sent by Atlassian JIRA (v6.3.4#6332)