sbt java.io.IOException:无法运行程序“javac”:java.io.IOException:error = 12,无法分配内存

时间:2013-11-06 09:04:25

标签: scala sbt javac

我尝试使用命令sbt -mem 2048 clean compile test设置CI,然后我得到了完整的

[info] Compiling 4 Scala sources and 8 Java sources to /opt/gitlab-6.2.2-0/apps/gitlabci/gitlabci-runner/tmp/builds/project-1/target/scala-2.10/classes...
[warn] there were 2 feature warnings; re-run with -feature for details
[warn] one warning found
java.io.IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:488)
    at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:386)
    at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:138)
    at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
    at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
    at sbt.compiler.JavacLogger.buffer(AggressiveCompile.scala:178)
    at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:169)
    at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:166)
    at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:157)
    at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:152)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.externalJavac$1(JavaCompiler.scala:82)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:103)
    at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:100)
    at sbt.IO$.withTemporaryDirectory(IO.scala:281)
    at sbt.compiler.JavaCompiler$.withArgumentFile(JavaCompiler.scala:100)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:79)
    at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:75)
    at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:71)
    at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:57)
    at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:26)
    at sbt.compiler.JavaCompiler$$anon$1.apply(JavaCompiler.scala:51)
    at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:17)
    at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:51)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply$mcV$sp(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(AggressiveCompile.scala:82)
    at sbt.classfile.Analyze$.apply(Analyze.scala:85)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4.compileJava$1(AggressiveCompile.scala:80)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
    at sbt.inc.Incremental$.cycle(Incremental.scala:45)
    at sbt.inc.Incremental$.compile(Incremental.scala:29)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
    at sbt.Compiler$.apply(Compiler.scala:79)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
    at sbt.std.Transform$$anon$5.work(System.scala:71)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:238)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
    at java.lang.ProcessImpl.start(ProcessImpl.java:81)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
    at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:386)
    at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:138)
    at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
    at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.scala:169)
    at sbt.compiler.JavacLogger.buffer(AggressiveCompile.scala:178)
    at sbt.AbstractProcessBuilder.runBuffered(ProcessImpl.scala:169)
    at sbt.AbstractProcessBuilder.$bang(ProcessImpl.scala:166)
    at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:157)
    at sbt.compiler.AggressiveCompile$$anonfun$forkJavac$1.apply(AggressiveCompile.scala:152)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.externalJavac$1(JavaCompiler.scala:82)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1$$anonfun$apply$2.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:103)
    at sbt.compiler.JavaCompiler$$anonfun$withArgumentFile$1.apply(JavaCompiler.scala:100)
    at sbt.IO$.withTemporaryDirectory(IO.scala:281)
    at sbt.compiler.JavaCompiler$.withArgumentFile(JavaCompiler.scala:100)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:83)
    at sbt.compiler.JavaCompiler$$anonfun$forkJavac$1.apply(JavaCompiler.scala:79)
    at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:75)
    at sbt.compiler.JavaCompiler$$anonfun$directOrForkJavac$1.apply(JavaCompiler.scala:71)
    at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:57)
    at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:26)
    at sbt.compiler.JavaCompiler$$anon$1.apply(JavaCompiler.scala:51)
    at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:17)
    at sbt.compiler.JavaCompiler$$anon$1.compile(JavaCompiler.scala:51)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply$mcV$sp(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:83)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(AggressiveCompile.scala:82)
    at sbt.classfile.Analyze$.apply(Analyze.scala:85)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply$mcV$sp(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileJava$1$1.apply(AggressiveCompile.scala:81)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4.compileJava$1(AggressiveCompile.scala:80)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
    at sbt.inc.Incremental$.cycle(Incremental.scala:45)
    at sbt.inc.Incremental$.compile(Incremental.scala:29)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
    at sbt.Compiler$.apply(Compiler.scala:79)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
    at sbt.std.Transform$$anon$5.work(System.scala:71)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:238)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
[error] (compile:compile) java.io.IOException: Cannot run program "javac": java.io.IOException: error=12, Cannot allocate memory
[error] Total time: 42 s, completed Nov 6, 2013 12:44:09 AM

CI日志位于:http://git.brut.us/gitlabci/projects/1/builds/d274440d0de549380bc5387085055ccc749803b9

我正在尝试构建的项目是来自akka书籍的样本(github上的源代码:https://github.com/RayRoestenburg/akka-in-action/tree/master/chapter2

项目本身很小,大约有5个scala文件。运行它的机器有4GB的内存。我假设有一些sbt配置需要设置更低的permsize所以它不消耗所有ram(或可能更高?)。我环顾四周,对此的方式是非常不一致的,我尝试了一些没有运气。

SBT:

$ sbt -v
# Executing command line:
java
-Xms1536m
-Xmx1536m
-XX:MaxPermSize=384m
-XX:ReservedCodeCacheSize=192m
-jar
/usr/lib/sbt/sbt-launch.jar

关于:This is sbt 0.12.0

任何帮助将不胜感激!

0 个答案:

没有答案