Bug 1092380 - NullPointerException raised while perform REST API request api/vms/***/applications for VM w/o installed applications
Summary: NullPointerException raised while perform REST API request api/vms/***/applic...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi
Version: 3.3.0
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
: 3.4.0
Assignee: Juan Hernández
QA Contact: Tareq Alayan
URL:
Whiteboard: infra
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-29 08:04 UTC by Yuri Obshansky
Modified: 2016-02-10 19:03 UTC (History)
11 users (show)

Fixed In Version: org.ovirt.engine-root-3.4.0-17
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-12 14:05:38 UTC
oVirt Team: Infra
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 27192 0 master MERGED restapi: Avoid NPE with empty app list Never
oVirt gerrit 27256 0 ovirt-engine-3.4 MERGED restapi: Avoid NPE with empty app list Never

Description Yuri Obshansky 2014-04-29 08:04:10 UTC
Description of problem:
NullPointerException raised while perform REST API request 
api/vms/***/applications for VM w/o installed applications
Expected empty string/no data 

Version-Release number of selected component (if applicable):
3.3.2-0.49.el6ev

How reproducible:
100% reproducible

Steps to Reproduce:
1. Create VM and start it
2. Run request 
GET https://10.1.32.58/api/vms/30991cf8-d28a-48c9-8a92-d60d8db3a4c1/applications
Request Headers:
Connection: keep-alive
Session-TTL: 360
Accept-Language: en-US,en;q=0.5
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131023 Firefox/17.0
Referer: 10.1.32.58/UserPortal/org.ovirt.engine.ui.userportal.UserPortal/UserPortal.html?locale=en_US
Accept-Encoding: gzip, deflate
Prefer: persistent-auth
Authorization: Basic ************
Filter: true
Host: *.*.*.*
3. NullPointerException raised in response 

Actual results:
<html><head><title>JBoss Web/7.3.0.Final-redhat-2 - JBWEB000064: Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>JBWEB000065: HTTP Status 500 - java.lang.NullPointerException</h1><HR size="1" noshade="noshade"><p><b>JBWEB000309: type</b> JBWEB000066: Exception report</p><p><b>JBWEB000068: message</b> <u>java.lang.NullPointerException</u></p><p><b>JBWEB000069: description</b> <u>JBWEB000145: The server encountered an internal error that prevented it from fulfilling this request.</u></p><p><b>JBWEB000070: exception</b> <pre>org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
	org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
	org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
	org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
	org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
	org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
	org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
	org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
	org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
	org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
</pre></p><p><b>JBWEB000071: root cause</b> <pre>java.lang.NullPointerException
	org.ovirt.engine.api.restapi.resource.BackendVmApplicationsResource.addParents(BackendVmApplicationsResource.java:40)
	org.ovirt.engine.api.restapi.resource.BackendVmApplicationsResource.addParents(BackendVmApplicationsResource.java:12)
	org.ovirt.engine.api.restapi.resource.AbstractBackendResource.addLinks(AbstractBackendResource.java:226)
	org.ovirt.engine.api.restapi.resource.AbstractBackendResource.addLinks(AbstractBackendResource.java:218)
	org.ovirt.engine.api.restapi.resource.BackendVmApplicationsResource.list(BackendVmApplicationsResource.java:28)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	java.lang.reflect.Method.invoke(Method.java:606)
	org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
	org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269)
	org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227)
	org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
	org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
	org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
	org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
	org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
	org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
	org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126)
	org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208)
	org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55)
	org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
</pre></p><p><b>JBWEB000072: note</b> <u>JBWEB000073: The full stack trace of the root cause is available in the JBoss Web/7.3.0.Final-redhat-2 logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.3.0.Final-redhat-2</h3></body></html>

Expected results:
empty string or data

Additional info:

Comment 1 Juan Hernández 2014-04-29 09:38:19 UTC
Yuri, what permissions had the user?

Comment 2 Yuri Obshansky 2014-04-29 10:12:00 UTC
(In reply to Juan Hernández from comment #1)
> Yuri, what permissions had the user?

User  has permission - UserVmManager

Comment 3 Juan Hernández 2014-04-29 11:04:30 UTC
I think that the problem here is that the list of applications is empty, instead of null, and the RESTAPI isn't well prepared for that case. Can you please check what is the content of the "app_list" field of the "vm_dynamic" table for that particular VM? Run the following query:

  select app_list, app_list is null as is_null from vm_dynamic where vm_guid = '30991cf8-d28a-48c9-8a92-d60d8db3a4c1/applications';

The result will probably be the following:

   app_list | is_null 
  ----------+---------
          | f
  (1 row)

That means that the app_list is empty, instead of null.

How was the list of applications populated? Manually? Using the guest agent?

Comment 4 Yuri Obshansky 2014-04-29 12:33:13 UTC
engine=# select app_list, app_list is null as is_null from vm_dynamic 
where vm_guid = '74471355-d46d-41c4-8a8b-9a4ff42f30e8';
  app_list | is_null
----------+---------
           | f
(1 row)

I think, guest agent

Comment 5 Juan Hernández 2014-04-29 12:40:44 UTC
I'm requesting the blocker flag because I think that this is a serious issue for the tests that Yuri plans to run on 3.4, but not sure if it is really needed in 3.4.0. The fix is ready, and minor, so I think there is no risk.

Yuri, what do you think, should this block release 3.4.0?

Comment 6 Yuri Obshansky 2014-04-29 12:46:53 UTC
I don't think it is a blocker issue for performance tests.
Because, I could create VMs from template with previously installed guest_agent or apply manually workaround:
#update vm_dynamic set app_list = null where app_list = ''; 
(as Juan early suggested).

Comment 7 Juan Hernández 2014-04-30 14:19:58 UTC
This change has been merged to the upstream 3.4 branch, so it will be available downstream with the next rebase.

Comment 8 Tareq Alayan 2014-06-05 10:48:31 UTC
verified on rhevm-3.4.0-0.21.el6ev.noarch, vdsm-4.14.7-3.el6ev.x86_64


https://10.35.161.144/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/applications

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vms>
    <vm href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66" id="6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66">
        <actions>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/ticket" rel="ticket"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/move" rel="move"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/migrate" rel="migrate"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/reboot" rel="reboot"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/detach" rel="detach"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/export" rel="export"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/commit_snapshot" rel="commit_snapshot"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/preview_snapshot" rel="preview_snapshot"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/cancelmigration" rel="cancelmigration"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/maintenance" rel="maintenance"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/undo_snapshot" rel="undo_snapshot"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/shutdown" rel="shutdown"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/start" rel="start"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/stop" rel="stop"/>
            <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/suspend" rel="suspend"/>
        </actions>
        <name>bz1092380</name>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/applications" rel="applications"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/disks" rel="disks"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/nics" rel="nics"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/cdroms" rel="cdroms"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/snapshots" rel="snapshots"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/tags" rel="tags"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/permissions" rel="permissions"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/statistics" rel="statistics"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/reporteddevices" rel="reporteddevices"/>
        <link href="/ovirt-engine/api/vms/6b5c25b4-23fa-4d5c-9a06-6b65ab1c6d66/watchdogs" rel="watchdogs"/>
        <type>server</type>
        <status>
            <state>up</state>
        </status>
        <memory>1073741824</memory>
        <cpu>
            <topology sockets="1" cores="1"/>
            <architecture>X86_64</architecture>
        </cpu>
        <cpu_shares>0</cpu_shares>
        <os type="other">
            <boot dev="hd"/>
        </os>
        <high_availability>
            <enabled>false</enabled>
            <priority>1</priority>
        </high_availability>
        <display>
            <type>spice</type>
            <address>monique-vds05.tlv.redhat.com</address>
            <port>5900</port>
            <secure_port>5901</secure_port>
            <monitors>1</monitors>
            <single_qxl_pci>false</single_qxl_pci>
            <allow_override>true</allow_override>
            <smartcard_enabled>false</smartcard_enabled>
        </display>
        <host href="/ovirt-engine/api/hosts/5221a5f7-f54c-4e2c-a507-5b2cf044f967" id="5221a5f7-f54c-4e2c-a507-5b2cf044f967"/>
        <cluster href="/ovirt-engine/api/clusters/5e926f1c-9940-4785-81d6-4e29da02935d" id="5e926f1c-9940-4785-81d6-4e29da02935d"/>
        <template href="/ovirt-engine/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
        <start_time>2014-06-05T13:39:32.802+03:00</start_time>
        <stop_time>2014-06-05T13:39:16.303+03:00</stop_time>
        <creation_time>2014-06-05T13:39:16.213+03:00</creation_time>
        <origin>ovirt</origin>
        <stateless>false</stateless>
        <delete_protected>false</delete_protected>
        <sso>
            <methods>
                <method id="GUEST_AGENT"/>
            </methods>
        </sso>
        <placement_policy>
            <host href="/ovirt-engine/api/hosts/5221a5f7-f54c-4e2c-a507-5b2cf044f967" id="5221a5f7-f54c-4e2c-a507-5b2cf044f967"/>
            <affinity>pinned</affinity>
        </placement_policy>
        <memory_policy>
            <guaranteed>1073741824</guaranteed>
        </memory_policy>
        <usb>
            <enabled>false</enabled>
        </usb>
        <migration_downtime>-1</migration_downtime>
    </vm>
</vms>

Comment 9 Itamar Heim 2014-06-12 14:05:38 UTC
Closing as part of 3.4.0


Note You need to log in before you can comment on or make changes to this bug.