ambari-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMBARI-18404) Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs
Date Fri, 16 Sep 2016 05:52:20 GMT

    [ https://issues.apache.org/jira/browse/AMBARI-18404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15495466#comment-15495466
] 

Hudson commented on AMBARI-18404:
---------------------------------

SUCCESS: Integrated in Jenkins build Ambari-trunk-Commit #5679 (See [https://builds.apache.org/job/Ambari-trunk-Commit/5679/])
AMBARI-18404 - Upgrade Summary Endpoint Throws NPEs Due To JPA Cached (jhurley: [http://git-wip-us.apache.org/repos/asf?p=ambari.git&a=commit&h=da5605706555d3aecca7a67fb399d9c501972ad4])
* (edit) ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
* (edit) ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
* (edit) ambari-server/src/main/java/org/apache/ambari/server/topology/HostRequest.java
* (edit) ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessorImpl.java
* (edit) ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java


> Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs
> --------------------------------------------------------------------------------
>
>                 Key: AMBARI-18404
>                 URL: https://issues.apache.org/jira/browse/AMBARI-18404
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.4.0
>            Reporter: Jonathan Hurley
>            Assignee: Jonathan Hurley
>            Priority: Critical
>             Fix For: 2.4.2
>
>         Attachments: AMBARI-18404.patch
>
>
> When creating an upgrade, the {{upgrades_summary}} endpoint sometimes returns a NPE.

> STR:
> - Start an upgrade
> - Force an error (remove {{hdp-select}})
> - Wait for error in upgrade, and then make a request to {{upgrades_summary}}
> {code}
> HostRoleCommandEntity mostRecentFailure = s_hostRoleCommandDAO.findMostRecentFailure(upgradeRequestId);
> {code}
> And its requestId is null
> DB is fine
> {code}
> ambari=> select request_id, task_id, status, role, role_command, custom_command_name
from host_role_command where task_id = 504;
>  request_id | task_id |      status      |    role     |  role_command  | custom_command_name
> ------------+---------+------------------+-------------+----------------+---------------------
>          45 |     504 | HOLDING_TIMEDOUT | NODEMANAGER | CUSTOM_COMMAND | STOP
> (1 row)
> {code}
> Problem is with query,
> {code}
>     TypedQuery<HostRoleCommandEntity> query = entityManagerProvider.get().createNamedQuery(
>         "HostRoleCommandEntity.findTasksByStatusesOrderByIdDesc", HostRoleCommandEntity.class);
>     query.setParameter("requestId", requestId);
>     query.setParameter("statuses", HostRoleStatus.STACK_UPGRADE_FAILED_STATUSES);
>     List<HostRoleCommandEntity> results = query.getResultList();
> ...
>     HostRoleCommandEntity candidate = results.get(0);
> {code}
> since "candidate" has no requestId.
> However, HostRoleCommandEntity.java defines the query like so,
> {code}
> @NamedQuery(name = "HostRoleCommandEntity.findTasksByStatusesOrderByIdDesc", query =
"SELECT task FROM HostRoleCommandEntity task WHERE task.requestId = :requestId AND task.status
IN :statuses ORDER BY task.taskId DESC"),
> {code}
> so the "task" object should have a request_id, especially since it's defined to be non-nullable,
> {code}
>   @Column(name = "request_id", insertable = false, updatable = false, nullable = false)
>   @Basic
>   private Long requestId;
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message