You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ambari.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2016/09/16 05:43:20 UTC
[jira] [Commented] (AMBARI-18404) Upgrade Summary Endpoint Throws
NPEs Due To JPA Cached Entities With Missing IDs
[ https://issues.apache.org/jira/browse/AMBARI-18404?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15495448#comment-15495448 ]
Hudson commented on AMBARI-18404:
---------------------------------
SUCCESS: Integrated in Jenkins build Ambari-branch-2.5 #44 (See [https://builds.apache.org/job/Ambari-branch-2.5/44/])
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=d6773ce6c76dc0c09fe607880a53bcaab8e06387])
* (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/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
* (edit) ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
* (edit) ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.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)