Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 503DE200B85 for ; Thu, 15 Sep 2016 18:14:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 4EEA7160ADB; Thu, 15 Sep 2016 16:14:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9DEAF160ABA for ; Thu, 15 Sep 2016 18:14:21 +0200 (CEST) Received: (qmail 39125 invoked by uid 500); 15 Sep 2016 16:14:20 -0000 Mailing-List: contact issues-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list issues@ambari.apache.org Received: (qmail 39105 invoked by uid 99); 15 Sep 2016 16:14:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Sep 2016 16:14:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 8E7F82C0D58 for ; Thu, 15 Sep 2016 16:14:20 +0000 (UTC) Date: Thu, 15 Sep 2016 16:14:20 +0000 (UTC) From: "Jonathan Hurley (JIRA)" To: issues@ambari.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (AMBARI-18404) Upgrade Summary Endpoint Throws NPEs Due To JPA Cached Entities With Missing IDs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Thu, 15 Sep 2016 16:14:22 -0000 [ https://issues.apache.org/jira/browse/AMBARI-18404?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jonathan Hurley updated AMBARI-18404: ------------------------------------- Fix Version/s: (was: 2.5.0) 2.4.2 > 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 > > > 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 query = entityManagerProvider.get().createNamedQuery( > "HostRoleCommandEntity.findTasksByStatusesOrderByIdDesc", HostRoleCommandEntity.class); > query.setParameter("requestId", requestId); > query.setParameter("statuses", HostRoleStatus.STACK_UPGRADE_FAILED_STATUSES); > List 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)