Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(l0_flush): drops permit before fsync, potential cause for OOMs #8327

Merged
merged 1 commit into from
Jul 9, 2024

Conversation

problame
Copy link
Contributor

@problame problame commented Jul 9, 2024

Problem

Slack thread: https://neondb.slack.com/archives/C033RQ5SPDH/p1720511577862519

We're seeing OOMs in staging on a pageserver that has l0_flush.mode=Direct enabled.

There's a strong correlation between jumps in maxrss_kb and pageserver_timeline_ephemeral_bytes, so, it's quite likely that l0_flush.mode=Direct is the culprit.

Notably, the expected max memory usage on that staging server by the l0_flush.mode=Direct is ~2GiB but we're seeing as much as 24GiB max RSS before the OOM kill.

One hypothesis is that we're dropping the semaphore permit before all the dirtied pages have been flushed to disk. (The flushing to disk likely happens in the fsync inside the .finish() call, because we're using ext4 in data=ordered mode).

Summary of changes

Hold the permit until after we're done with .finish().

@problame problame requested a review from jcsp July 9, 2024 16:24
@problame problame requested a review from a team as a code owner July 9, 2024 16:24
@problame problame enabled auto-merge (squash) July 9, 2024 16:38
Copy link

github-actions bot commented Jul 9, 2024

3042 tests run: 2927 passed, 0 failed, 115 skipped (full report)


Flaky tests (3)

Postgres 16

  • test_tenant_creation_fails: debug

Postgres 15

Postgres 14

Code coverage* (full report)

  • functions: 32.6% (6940 of 21281 functions)
  • lines: 50.0% (54561 of 109077 lines)

* collected from Rust tests only


The comment gets automatically updated with the latest test results
82057ca at 2024-07-09T17:18:37.651Z :recycle:

@problame problame merged commit 9bb16c8 into main Jul 9, 2024
65 checks passed
@problame problame deleted the problame/l0flush-extend-permit-lifetime branch July 9, 2024 18:58
skyzh pushed a commit that referenced this pull request Jul 15, 2024
…8327)

## Problem

Slack thread:
https://neondb.slack.com/archives/C033RQ5SPDH/p1720511577862519

We're seeing OOMs in staging on a pageserver that has
l0_flush.mode=Direct enabled.

There's a strong correlation between jumps in `maxrss_kb` and
`pageserver_timeline_ephemeral_bytes`, so, it's quite likely that
l0_flush.mode=Direct is the culprit.

Notably, the expected max memory usage on that staging server by the
l0_flush.mode=Direct is ~2GiB but we're seeing as much as 24GiB max RSS
before the OOM kill.

One hypothesis is that we're dropping the semaphore permit before all
the dirtied pages have been flushed to disk. (The flushing to disk
likely happens in the fsync inside the `.finish()` call, because we're
using ext4 in data=ordered mode).

## Summary of changes

Hold the permit until after we're done with `.finish()`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants