You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Tim Armstrong (JIRA)" <ji...@apache.org> on 2017/10/28 17:33:02 UTC

[jira] [Resolved] (IMPALA-1575) Cancelled queries do not yield resources until close

     [ https://issues.apache.org/jira/browse/IMPALA-1575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tim Armstrong resolved IMPALA-1575.
-----------------------------------
       Resolution: Fixed
    Fix Version/s: Impala 2.11.0


IMPALA-1575: Part 1: eagerly release query exec resources

Release of backend resources for query execution on the coordinator
daemon should occur eagerly as soon as query execution is finished
or cancelled. Before this patch some resources managed by QueryState,
like scratch files, were only released when the query was closed
and all of the query's control structures were torn down.

These resources are referred to as "ExecResources" in various places to
distinguish them from resources associated with the client request (like
the result cache) that are still required after the query finishes
executing.

This first change does not solve the admission control problem for two
reasons:
* We don't release the "admitted" memory on the coordinator until
  the query is unregistered.
* Admission control still considers the memory reserved until the
  query memtracker is unregistered, which happens only when the
  QueryState is destroyed: see MemTracker::GetPoolMemReserved().

The flow is mostly similar to initial_reservation_refcnt_, except the
coordinator also holds onto a reference count, which is released
when either the final row is returned or cancellation is initiated.
After the coordinator releases its refcount, the resources can be
freed as soon as local fragments also release their refcounts.

Also clean up Coordinator slightly by preventing runtime_state() from
leaking out to ClientRequestState - instead it's possible to log
the query MemTracker by following parent links in the MemTracker.

This patch is partially based on Joe McDonnell's IMPALA-1575 patch.

Testing:
Ran core tests.

Change-Id: I41ff374b0403f10a145f7fee9b3145953ee32341
Reviewed-on: http://gerrit.cloudera.org:8080/8303
Reviewed-by: Tim Armstrong <ta...@cloudera.com>
Tested-by: Impala Public Jenkins

> Cancelled queries do not yield resources until close
> ----------------------------------------------------
>
>                 Key: IMPALA-1575
>                 URL: https://issues.apache.org/jira/browse/IMPALA-1575
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Backend
>    Affects Versions: Impala 2.1, Impala 2.3.0
>            Reporter: Henry Robinson
>            Assignee: Tim Armstrong
>            Priority: Critical
>              Labels: query-lifecycle, resource-management
>             Fix For: Impala 2.11.0
>
>
> A cancelled query (for example due to a timeout) or a query that has reached eos (but not explicitly closed) holds (1) resources on the coordinator fragment, (2) all resources accounted by the admission controller, (3) llama reservations. (However, Llama has been unsupported for CDH 5.5 and beyond, so (3) will no longer apply.) All of these are not released until the query is closed, which may not happen promptly for some clients.
> This frequently occurs with Hue. Hue (and some other clients that behave similarly) will not close a query until explicitly closed (in the Hue case this is via a javascript callback sent by the browser when closing the Hue tab). If the query is left unattended (or the Hue tab is on a laptop that is closed, or the browser crashes), the close call is never sent, and while the query will "time out", the cancellation doesn't properly clean up resources.
> One way to mitigate this issue in this case is by using the --idle_session_timeout impalad argument to fully close a session and all associated queries after some amount of time (but this is not a workaround that works in all cases).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)