-
Notifications
You must be signed in to change notification settings - Fork 281
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
Abandoning thousands of commits runs out of memory #4352
Comments
Tried this where the second remote is https://github.com/facebook/buck2 and it doesn't happen. I think you need a repo with a lot of merge commits, which facebook's exported git repos do not. |
There is a workaround:
|
Maybe you had to use Regarding memory usage, I think the main problem is that our caching layer doesn't yet have upper bounds to purge old commit/tree entries. It'll need a simple LRU or something. |
If merge-heavy history was abandoned, intermediate parent chains can have tons of duplicates, and the process explodes soon. Instead, we can skip any parent ids that have been remapped. We can no longer detect cycles reliably, but I think that's okay so long as the function terminates. Fixes martinvonz#4352
This was quadratic before, and was super slow if thousands of commits were abandoned. martinvonz#4352
This was quadratic before, and was super slow if thousands of commits were abandoned. martinvonz#4352
This was quadratic before, and was super slow if thousands of commits were abandoned. #4352
Description
Abandoning lots of commits at once seems to have unbounded memory use and cannot finish. This has bricked a repo of mine because you can't undo deleting a git remote, jj must abandon them all before it can do anything else.
Steps to Reproduce the Problem
git clone URL
andjj git init --colocate
git remote add other_repo OTHERURL
jj git fetch --all-remotes
jj log
so it picks it up.git remote rm other_repo
jj log
(it says abandoning 2000 commits that are no longer reachable, and hangs there)Expected Behavior
The computer does not run out of memory
Actual Behavior
Huge freeze, jj using 8GB of RAM last time the computer managed to render a frame with htop visible. I managed to record a sample, and jj is rebasing all descendants, ad infinitum. It eventually got a SIGKILL.
Running again on a quiet system, memory use grows and shrinks in cycles -- 10, 11, 12, 13, 14, 11, 12, 13, 15, 12, 13, 14, 16, ... 17, ... 18GB. Now up to 26GB. Gets stuck in swap and then gets killed.
To me, it looks like the commits are abandoned one by one from the oldest onwards, and then every single time it abandons one, it rebases the rest. And does this all in-memory. If that is the case, is it possible to do them in reverse order? Or figure out which branches are going to need rebasing, and wait until all abandonments have completed before attempting to rebase them?
Specifications
The text was updated successfully, but these errors were encountered: