Skip to content

Ensure memory is freed in SpoolingExchangeOutputBuffer#13717

Merged
arhimondr merged 1 commit intotrinodb:masterfrom
arhimondr:force-free-memory-spooling-output-buffer
Aug 18, 2022
Merged

Ensure memory is freed in SpoolingExchangeOutputBuffer#13717
arhimondr merged 1 commit intotrinodb:masterfrom
arhimondr:force-free-memory-spooling-output-buffer

Conversation

@arhimondr
Copy link
Copy Markdown
Contributor

Description

Close memory context to prevent race condition when memory is reserved
in enqueuePage after output buffer destroy following the pattern used in
other output buffers

Is this change a fix, improvement, new feature, refactoring, or other?

Fix

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

Core engine

How would you describe this change to a non-technical end user or system administrator?

N/A

Related issues, pull requests, and links

#13362

Documentation

(X) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(X) No release notes entries required.
( ) Release notes entries required with the following suggested text:

Close memory context to prevent race condition when memory is reserved
in enqueuePage after output buffer destroy following the pattern used in
other output buffers
{
LocalMemoryContext context = getSystemMemoryContextOrNull();
if (context != null) {
context.close();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not every memory context is closeable, see https://github.com/trinodb/trino/pull/13213/files#diff-1774b86bf4c8b2248f02693fe0b0c6acc38305a6773ca813f5957601207a8168R338.
I think we can assume that only memory context created from io.trino.memory.context.AggregatedMemoryContext#newAggregatedMemoryContext are closeable

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.

@arhimondr arhimondr merged commit c48d1b1 into trinodb:master Aug 18, 2022
@arhimondr arhimondr deleted the force-free-memory-spooling-output-buffer branch August 18, 2022 20:18
@github-actions github-actions bot added this to the 394 milestone Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants