question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OutOfMemoryError if running sbt from the root directory

See original GitHub issue

On a Linux machine, using sbt 0.3.15:

cd / (yes, the root) sbt about

java.lang.OutOfMemoryError: GC overhead limit exceeded
  at java.io.UnixFileSystem.resolve(UnixFileSystem.java:108)
  at java.io.File.<init>(File.java:262)
  at java.io.File.listFiles(File.java:1284)
  at sbt.FilterFiles.handleFile(Path.scala:182)
  at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:198)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:200)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:199)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
  at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:199)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:200)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:199)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
  at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:199)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:200)
  at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant$1.apply(Path.scala:199)
  at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
  at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:108)
  at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:199)
  at 
....

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
aliensciencecommented, Jul 18, 2017

I am sorry to do a +1 on this, but I lost several hours setting up a Docker container because the Docker ‘RUN’ command defaults to the ‘/’ directory and sbt proceeded to run out of memory. I was just trying to initialize sbt by running:

$ sbt exit

Something simple like:

if (directory == "/") {
   throw new IllegalStateException("Cannot run sbt from root directory")    
}

would have have saved a lot of trouble.

0reactions
eed3si9ncommented, Sep 20, 2019

using sbt 1.2.8:

[warn] No sbt.version set in project/build.properties, base directory: /
java.lang.OutOfMemoryError: GC overhead limit exceeded
	at java.base/sun.nio.fs.UnixPath.resolve(UnixPath.java:400)
	at java.base/sun.nio.fs.UnixPath.resolve(UnixPath.java:413)
	at java.base/sun.nio.fs.UnixPath.resolve(UnixPath.java:418)
	at java.base/sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.readNextEntry(UnixDirectoryStream.java:182)
	at java.base/sun.nio.fs.UnixDirectoryStream$UnixDirectoryIterator.hasNext(UnixDirectoryStream.java:198)
	at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:348)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2760)
	at sbt.io.DescendantOrSelfPathFinder.handleFileDescendant(Path.scala:456)
	at sbt.io.DescendantOrSelfPathFinder.$anonfun$addTo$1(Path.scala:447)
	at sbt.io.DescendantOrSelfPathFinder.$anonfun$addTo$1$adapted(Path.scala:445)
	at sbt.io.DescendantOrSelfPathFinder$$Lambda$733/0x000000010070b840.apply(Unknown Source)
	at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:58)
	at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:51)
	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:47)
	at sbt.io.DescendantOrSelfPathFinder.addTo(Path.scala:445)
	at sbt.io.PathFinder.get(Path.scala:390)
	at sbt.io.PathFinder.pair(Path.scala:370)
	at sbt.io.IO$.copyDirectory(IO.scala:799)
	at sbt.io.IO$.copyDirectory(IO.scala:789)
	at sbt.io.IO$.copyDirectory(IO.scala:772)
	at sbt.Resolvers$.$anonfun$local$3(Resolvers.scala:34)
	at sbt.Resolvers$$$Lambda$729/0x0000000100708440.apply$mcV$sp(Unknown Source)
	at sbt.Resolvers$.creates(Resolvers.scala:148)
	at sbt.Resolvers$.$anonfun$local$2(Resolvers.scala:34)
	at sbt.Resolvers$$$Lambda$726/0x0000000100707040.apply(Unknown Source)
	at sbt.internal.BuildLoader$.$anonfun$componentLoader$2(BuildLoader.scala:172)
	at sbt.internal.BuildLoader$$$Lambda$728/0x0000000100708840.apply(Unknown Source)
	at scala.Option.map(Option.scala:146)
	at sbt.internal.BuildLoader$.$anonfun$componentLoader$1(BuildLoader.scala:171)
	at sbt.internal.BuildLoader$$$Lambda$709/0x00000001006fc040.apply(Unknown Source)
	at sbt.internal.MultiHandler.apply(BuildLoader.scala:28)
	at sbt.internal.BuildLoader.apply(BuildLoader.scala:240)
Error during sbt execution: java.lang.OutOfMemoryError: GC overhead limit exceeded

using sbt 1.3.2:

[warn] No sbt.version set in project/build.properties, base directory: /
java.lang.OutOfMemoryError: Java heap space
	at java.base/java.util.Arrays.copyOfRange(Arrays.java:4030)
	at java.base/java.lang.StringCoding.decodeASCII(StringCoding.java:524)
	at java.base/java.lang.StringCoding.decode(StringCoding.java:257)
	at java.base/java.lang.String.<init>(String.java:507)
	at java.base/java.lang.String.<init>(String.java:561)
	at java.base/sun.nio.fs.Util.toString(Util.java:63)
	at java.base/sun.nio.fs.UnixPath.toString(UnixPath.java:788)
	at java.base/sun.nio.fs.UnixPath.getPathForPermissionCheck(UnixPath.java:189)
	at java.base/sun.nio.fs.UnixPath.checkRead(UnixPath.java:818)
	at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:49)
	at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:145)
	at java.base/sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99)
	at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
	at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219)
	at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
	at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:373)
	at java.base/java.nio.file.Files.walkFileTree(Files.java:2760)
	at sbt.io.DescendantOrSelfPathFinder$.default(Path.scala:684)
	at sbt.io.Path$.$anonfun$defaultDescendantHandler$3(Path.scala:312)
	at sbt.io.Path$.$anonfun$defaultDescendantHandler$3$adapted(Path.scala:312)
	at sbt.io.Path$$$Lambda$71/0x0000000100381440.apply(Unknown Source)
	at sbt.io.DescendantOrSelfPathFinder$$anonfun$$lessinit$greater$1.apply(Path.scala:648)
	at sbt.io.DescendantOrSelfPathFinder$$anonfun$$lessinit$greater$1.apply(Path.scala:648)
	at sbt.io.DescendantOrSelfPathFinder.$anonfun$addTo$1(Path.scala:652)
	at sbt.io.DescendantOrSelfPathFinder.$anonfun$addTo$1$adapted(Path.scala:650)
	at sbt.io.DescendantOrSelfPathFinder$$Lambda$1091/0x0000000100a17040.apply(Unknown Source)
	at scala.collection.mutable.ResizableArray.foreach(ResizableArray.scala:62)
	at scala.collection.mutable.ResizableArray.foreach$(ResizableArray.scala:55)
	at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:49)
	at sbt.io.DescendantOrSelfPathFinder.addTo(Path.scala:650)
	at sbt.io.PathFinderImpl.get(Path.scala:603)
	at sbt.io.PathFinderDefaults.pair(Path.scala:550)
Error during sbt execution: java.lang.OutOfMemoryError: Java heap space

Either case [warn] No sbt.version set in project/build.properties, base directory: / is printed, so that’s a place we can perform this check.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Out of Memory Error when testing Scala (sbt) project
The client may fail to handle large Scala/sbt projects resulting in an Out of Memory (OOM) error: [error] (run-main-0) java.lang.
Read more >
cannot run sbt from root directory - docker - Stack Overflow
I believe the issue is using root aka / as the working directory. Adding WORKDIR /home before the RUN ... command fixes the...
Read more >
Scala: How to give SBT more memory (RAM) to work with
As a brief note, I was trying to run a Scala application inside SBT today and kept getting this “out of memory” error:...
Read more >
sbt/sbt - Gitter
lang.OutOfMemoryError: Metaspace while running some test with sbt. According to oracle by the metaspace is in the native heap and is unlimited. You...
Read more >
GC overhead limit exceeded running sbt compilation
Since it is running out of memory, does it help if you add some more? Like: export SBT_OPTS="-Xmx1500M" Cheers, Juha.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found