rtyley / bfg-repo-cleaner

Removes large or troublesome blobs like git-filter-branch does, but faster. And written in Scala
https://rtyley.github.io/bfg-repo-cleaner/
GNU General Public License v3.0
10.83k stars 535 forks source link

StackOverflowError #457

Open swingbit opened 2 years ago

swingbit commented 2 years ago

I got this while trying to apply replacements to a bare repo. The replacement file is in the form:

CORE-1==>sbs/core#1
CORE-2==>sbs/core#2
CORE-3==>sbs/core#3

for a total of 2709 lines. Too many?

Output:

# java -jar bfg-1.14.0.jar --replace-text utils.repl utils.git

Using repo : utils.git

Found 583 objects to protect
Found 191 commit-pointing refs : HEAD, refs/heads/Utils-1.6, refs/heads/Utils-1.7, ...
Found 30 tag-pointing refs : refs/tags/1.11.3, refs/tags/Utils-1.10.0, refs/tags/Utils-1.10.1, ...

Protected commits
-----------------

These are your protected commits, and so their contents will NOT be altered:

java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at use.newer.java.Util.invokeMainMethod(Util.java:89)
    at use.newer.java.Util.executeMainProgram(Util.java:28)
    at use.newer.java.Util.checkJavaVersionAndExecuteMainProgram(Util.java:18)
    at use.newer.java.Version8.main(Version8.java:5)
Caused by: com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4935)
    at com.madgag.git.bfg.MemoUtil$$anon$2.apply(memo.scala:60)
    at com.madgag.git.bfg.GitUtil$$anon$1.apply(GitUtil.scala:71)
    at com.madgag.git.bfg.CleaningMapper.replacement(GitUtil.scala:46)
    at com.madgag.git.bfg.CleaningMapper.replacement$(GitUtil.scala:45)
    at com.madgag.git.bfg.GitUtil$$anon$1.replacement(GitUtil.scala:70)
    at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.$anonfun$reportsFor$3(ProtectedObjectDirtReport.scala:45)
    at scala.util.Either.fold(Either.scala:189)
    at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.$anonfun$reportsFor$1(ProtectedObjectDirtReport.scala:45)
    at scala.collection.Iterator$$anon$9.next(Iterator.scala:575)
    at scala.collection.mutable.Growable.addAll(Growable.scala:65)
    at scala.collection.mutable.Growable.addAll$(Growable.scala:60)
    at scala.collection.immutable.SetBuilderImpl.addAll(Set.scala:396)
    at scala.collection.immutable.Set$.from(Set.scala:353)
    at scala.collection.immutable.Set$.from(Set.scala:93)
    at scala.collection.IterableOps.map(Iterable.scala:671)
    at scala.collection.IterableOps.map$(Iterable.scala:671)
    at scala.collection.AbstractIterable.map(Iterable.scala:919)
    at com.madgag.git.bfg.cleaner.protection.ProtectedObjectDirtReport$.reportsFor(ProtectedObjectDirtReport.scala:43)
    at com.madgag.git.bfg.cleaner.CLIReporter.reportProtectedCommitsAndTheirDirt(Reporter.scala:133)
    at com.madgag.git.bfg.cleaner.CLIReporter.reportObjectProtection(Reporter.scala:106)
    at com.madgag.git.bfg.cleaner.RepoRewriter$.rewrite(RepoRewriter.scala:96)
    at com.madgag.git.bfg.cli.Main$.$anonfun$new$1(Main.scala:59)
    at com.madgag.git.bfg.cli.Main$.$anonfun$new$1$adapted(Main.scala:34)
    at scala.Option.map(Option.scala:242)
    at com.madgag.git.bfg.cli.Main$.delayedEndpoint$com$madgag$git$bfg$cli$Main$1(Main.scala:34)
    at com.madgag.git.bfg.cli.Main$delayedInit$body.apply(Main.scala:27)
    at scala.Function0.apply$mcV$sp(Function0.scala:39)
    at scala.Function0.apply$mcV$sp$(Function0.scala:39)
    at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
    at scala.App.$anonfun$main$1(App.scala:76)
    at scala.App.$anonfun$main$1$adapted(App.scala:76)
    at scala.collection.IterableOnceOps.foreach(IterableOnce.scala:563)
    at scala.collection.IterableOnceOps.foreach$(IterableOnce.scala:561)
    at scala.collection.AbstractIterable.foreach(Iterable.scala:919)
    at scala.App.main(App.scala:76)
    at scala.App.main$(App.scala:74)
    at com.madgag.git.bfg.cli.Main$.main(Main.scala:27)
    at com.madgag.git.bfg.cli.Main.main(Main.scala)
    ... 8 more
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.StackOverflowError
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049)
    at com.google.common.cache.LocalCache.get(LocalCache.java:3951)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3974)
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4935)
    at com.madgag.git.bfg.MemoUtil$$anon$2.apply(memo.scala:60)
    at scala.collection.immutable.List.map(List.scala:246)
    at scala.collection.immutable.List.map(List.scala:79)
    at com.madgag.git.bfg.cleaner.TreeBlobModifier.apply(TreeBlobModifier.scala:37)
    at com.madgag.git.bfg.cleaner.TreeBlobModifier.apply$(TreeBlobModifier.scala:37)
    at com.madgag.git.bfg.cli.CLIConfig$$anon$2.apply(CLIConfig.scala:174)
    at com.madgag.git.bfg.cli.CLIConfig$$anon$2.apply(CLIConfig.scala:174)
    at scala.Function$.$anonfun$chain$2(Function.scala:23)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at scala.Function$.$anonfun$chain$1(Function.scala:23)
    at com.madgag.git.bfg.cleaner.ObjectIdCleaner.$anonfun$cleanTree$1(ObjectIdCleaner.scala:125)
    at com.madgag.git.bfg.MemoUtil$$anon$3.load(memo.scala:74)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3529)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2278)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2155)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2045)
    ... 49 more
Caused by: java.lang.StackOverflowError
    at scala.Function$.$anonfun$chain$2(Function.scala:23)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at scala.Function$.$anonfun$chain$1(Function.scala:23)
    at scala.Function$.$anonfun$chain$2(Function.scala:23)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at scala.Function$.$anonfun$chain$1(Function.scala:23)
    at scala.Function$.$anonfun$chain$2(Function.scala:23)
    at scala.collection.LinearSeqOps.foldLeft(LinearSeq.scala:169)
    at scala.collection.LinearSeqOps.foldLeft$(LinearSeq.scala:165)
    at scala.collection.immutable.List.foldLeft(List.scala:79)
    at scala.Function$.$anonfun$chain$1(Function.scala:23)

.... many many of the same