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

Add a configurable cap on total pantsd memory usage. #10003

Merged
merged 3 commits into from
Jun 9, 2020

Conversation

stuhood
Copy link
Member

@stuhood stuhood commented Jun 8, 2020

Problem

pantsd does not implement garbage collection of the Graph (see #7675), but additionally, there are likely a few Python-level reference cycles beyond those that we have already discovered.

Solution

We will eventually implement #7675, and it will need a config value to control how much it collects. But in the meantime, having a configurable built-in cap on total memory usage is generally useful, and can consume the same flag that our eventual collection will.

Result

pantsd will restart itself when it uses more than the configured amount of memory (defaulting to 4GB). As mentioned in the test comment, until #8200 is fixed, the message rendered when we restart will not be particularly friendly, so we should likely not cherry-pick this to 1.29.x, which will not receive #8200.

This is not a complete fix for #9999, but I'm going to resolve it in favor of tracking followup in #7675.

[ci skip-rust-tests]
[ci skip-jvm-tests]

# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]
# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Good idea.

@@ -399,6 +399,22 @@ def test_pantsd_memory_usage(self):
),
)

def test_pantsd_max_memory_usage(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Will probably want to sanity check that test_pantsd_memory_usage is still relevant. I know they do different things, but possible bit rot not. NB that we skip it due to flakiness.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is still relevant (see the comments on the ticket linked in the description of this PR), but I have not been able to follow up on re-enabling it.

stuhood and others added 2 commits June 8, 2020 13:47
# Delete this line to force CI to run Clippy and the Rust tests.
[ci skip-rust-tests]
# Delete this line to force CI to run the JVM tests.
[ci skip-jvm-tests]
@stuhood stuhood merged commit fa53e8e into pantsbuild:master Jun 9, 2020
@stuhood stuhood deleted the stuhood/pantsd-memory-monitoring branch June 9, 2020 03:57
@stuhood stuhood mentioned this pull request Jun 9, 2020
stuhood added a commit that referenced this pull request Jul 7, 2020
### Problem

The default max memory usage from #10003 was chosen with larger monorepos in mind, and didn't match the expectation of consumers in smaller repos. 

### Solution

Very large repos will have folks who are able/willing to adjust limits like this to optimize for their repo size, so adjust the default down in favor of having good defaults.  This relates to #7675, but it isn't the time to dive in there.

### Result

Fixes #10264.

[ci skip-rust-tests]
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.

3 participants