Skip to content

HIVE-29632: hive.fetch.task.caching=true causes unbounded heap allocation thus crashing HiveServer2 with OutOfMemoryError#6510

Open
vikramahuja1001 wants to merge 1 commit into
apache:masterfrom
vikramahuja1001:HIVE-fetch-task-caching-acid-only
Open

HIVE-29632: hive.fetch.task.caching=true causes unbounded heap allocation thus crashing HiveServer2 with OutOfMemoryError#6510
vikramahuja1001 wants to merge 1 commit into
apache:masterfrom
vikramahuja1001:HIVE-fetch-task-caching-acid-only

Conversation

@vikramahuja1001
Copy link
Copy Markdown
Contributor

@vikramahuja1001 vikramahuja1001 commented May 27, 2026

What changes were proposed in this pull request?

hive.fetch.task.caching=true causes unbounded heap allocation and crashes HiveServer2 with OutOfMemoryError

Why are the changes needed?

Refer : https://issues.apache.org/jira/browse/HIVE-29632

Does this PR introduce any user-facing change?

No

How was this patch tested?

HiveConf.ConfVars.HIVE_FETCH_TASK_CACHING);
if (cachingEnabled && !AcidUtils.isTransactionalTable(fetch.table)) {
LOG.debug("Fetch task caching is enabled but table {} is not transactional. " +
"Caching is only supported for ACID tables to prevent Cleaner race conditions. Disabling.",
Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ Jun 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are those Cleaner race conditions? regardless, flag only make sense for ACID tables

PS: i think this whole thing is obsolete since Cleaner doesn't use locks in Hive-4.x.
cc @kuczoram

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned the Log statement

Copy link
Copy Markdown
Member

@deniskuzZ deniskuzZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

…eap allocation thus crashing HiveServer2 with OutOfMemoryError
@vikramahuja1001 vikramahuja1001 force-pushed the HIVE-fetch-task-caching-acid-only branch from 29f35eb to 4bce58b Compare June 2, 2026 05:16
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jun 2, 2026

"\n" + org.apache.hadoop.util.StringUtils.stringifyException(e));
throw new CommandProcessorException(1);
} finally {
} catch (RuntimeException e) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reason for this change:

  1. The SimpleFetchOptimizer change disables caching for non-ACID tables, making FetchTask.execute() a no op. Rows are now fetched lazily via Driver.getResults() after qp.run(). So the exceptions that previously surfaced inside qp.run() now escapes as unchecked RunTimeException from the fetch loop.
  2. ProcessLocalCmd() only caught IOExceptions, so the RunTImeException bubbled up and never became a CommandProcessorException causing tests tests like, udf_assert_true.q, udf_assert_true2.q to fail.
  3. The fix adds a separate catch (RuntimeException e) that silently converts it to CommandProcessorException. It intentionally does not reprint the error since FetchTask.executeInner() already did that. Plus doing that will change .q.out file which i was trying to avoid.

@vikramahuja1001
Copy link
Copy Markdown
Contributor Author

@deniskuzZ , the build is green for this PR. Can you kindly recheck this PR?

@vikramahuja1001 vikramahuja1001 requested a review from deniskuzZ June 2, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants