SBT测试中的奇怪异常

SBT测试中的奇怪异常

本文介绍了SBT测试中的奇怪异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我遇到了 SBT(版本 0.13.9)的问题.我的 ScalaTest 测试之一失败,不确定性EOFException.

I am facing an issue with SBT (version 0.13.9). One of my ScalaTest tests fails not deterministic with EOFException.

堆栈跟踪:

Exception in thread "Thread-155" Exception in thread "Thread-159" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at sbt.React.react(ForkTests.scala:114)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:74)
at java.lang.Thread.run(Thread.java:745)

java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2601)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1319)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1$React.react(Framework.scala:953)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1.run(Framework.scala:942)
at java.lang.Thread.run(Thread.java:745)

sbt.ForkMain 59974 failed with exit code 134

我没有看到任何 JVM 日志或线程转储.

I don't see any JVM logs or thread dumps.

推荐答案

几乎可以肯定,这与在某些 linux 发行版中调用 sbt.ForkMain 时 Java 类路径过长有关.为了避免这种情况,我添加了

Almost certainly this is related to the Java classpath being too long when invoking sbt.ForkMain in certain linux distros. To avoid this I added

javaOptions in Test ++= Seq("-Xms1G","-XX:+CMSClassUnloadingEnabled","-XX:+UseConcMarkSweepGC")

build.sbt 文件.我认为 CMSClassUnloadingEnabled 是魔法发生的地方.

to the build.sbt file. I reckon CMSClassUnloadingEnabled is where the magic happens.

这篇关于SBT测试中的奇怪异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 21:54