尝试通过 sbt 构建项目时 Docker 中超出了 GC 开销限制
GC overhead limit exceeded in Docker when trying to build project by sbt
我正在尝试在 docker 容器中构建 sbt 项目并收到这样的错误:
java.lang.OutOfMemoryError: GC overhead limit exceeded
系统规格:
- OS osx + boot2docker(虚拟机 8 gig RAM)
- ubuntu 15.10 在 docker 容器内
- Oracle java 1.7 或 Oracle java 1.8 或 OpenJdk 1.8
- Scala 版本 2.11.6
- sbt 版本 0.13.8
如果我是 运行 docker 使用 Dockerfile 构建,它会失败 仅 。如果我通过登录到容器手动执行此操作,它会构建项目 w/o 异常。
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=1G; support was removed in 8.0
sbt appears to be exiting abnormally.
The log file for this session is at /tmp/sbt4972348477806548245.log
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:1290)
at sbt.FilterFiles.handleFile(Path.scala:192)
at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:204)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
Error during sbt execution: java.lang.OutOfMemoryError: GC overhead limit exceeded
2015/07/15 21:59:19 The command '/bin/sh -c /web/tools/bin/sbt compile' returned a non-zero code: 1
非常感谢您的帮助!!1
问题出在 sbt 设置 USER someuser
然后 运行 sbt clean
这个用户下。解决方案在 运行 sbt clean
w/ next command RUN runuser -l someuser -c 'sbt clean
.
是:
USER someuser
sbt clean
成为:
runuser -l someuser -c 'sbt clean'
我正在尝试在 docker 容器中构建 sbt 项目并收到这样的错误:
java.lang.OutOfMemoryError: GC overhead limit exceeded
系统规格:
- OS osx + boot2docker(虚拟机 8 gig RAM)
- ubuntu 15.10 在 docker 容器内
- Oracle java 1.7 或 Oracle java 1.8 或 OpenJdk 1.8
- Scala 版本 2.11.6
- sbt 版本 0.13.8
如果我是 运行 docker 使用 Dockerfile 构建,它会失败 仅 。如果我通过登录到容器手动执行此操作,它会构建项目 w/o 异常。
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=1G; support was removed in 8.0
sbt appears to be exiting abnormally.
The log file for this session is at /tmp/sbt4972348477806548245.log
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:1290)
at sbt.FilterFiles.handleFile(Path.scala:192)
at sbt.DescendantOrSelfPathFinder.sbt$DescendantOrSelfPathFinder$$handleFileDescendant(Path.scala:204)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
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:205)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:206)
at sbt.DescendantOrSelfPathFinder$$anonfun$sbt$DescendantOrSelfPathFinder$$handleFileDescendant.apply(Path.scala:205)
Error during sbt execution: java.lang.OutOfMemoryError: GC overhead limit exceeded
2015/07/15 21:59:19 The command '/bin/sh -c /web/tools/bin/sbt compile' returned a non-zero code: 1
非常感谢您的帮助!!1
问题出在 sbt 设置 USER someuser
然后 运行 sbt clean
这个用户下。解决方案在 运行 sbt clean
w/ next command RUN runuser -l someuser -c 'sbt clean
.
是:
USER someuser
sbt clean
成为:
runuser -l someuser -c 'sbt clean'