New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fork in test should handle exceptions during creation of test class #653
Comments
/cc @aloiscochard |
Yes, a test case usually helps fix it sooner. You are on 0.12.2, right? |
0.12.2 indeed. Will try to create an isolated test case. |
I updated a previous project with a SBT test case to throw an exception during test construction: The output using SBT 0.12.2 in my machine:
|
Thanks! |
I seem to be getting this error with sbt 0.13.0. Exception in thread "Thread-3" java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2577)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1297)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:349)
at sbt.React.react(ForkTests.scala:110)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:69)
at java.lang.Thread.run(Thread.java:695) |
@taylorleese certainly it is a bug, but it is unlikely to have the same cause and warrants a separate issue. Unfortunately, I'd need a test case. sbt 0.13.1 might help pinpoint the problem with more logging, but I don't know if it will do anything at this point in execution. (0.13.1-RC1 had some issues so it wasn't announced- RC2 will be out this week.) |
I'm seeing this as well on sbt 0.13.0
|
Same on sbt 0.13.1-RC2:
|
@cchantep right, there hasn't been a new fix since the original fix. I need a test case to be able to do anything- the stack trace doesn't help much, unfortunately. The earlier comment about 0.13.1 was that it might have additional information useful for producing a test case. |
Will see if I can extract a clear test case from the erroneous involved specs test. |
Thanks a lot. I'd appreciate it. |
Unfortunatly it seems several test combinations given the blocking situation, I can restrict it more than https://github.com/playframework/playframework/blob/master/framework/src/anorm/src/test/scala/anorm/AnormSpec.scala . If you comment out at least one test, sbt execution is ok, running all is blocked (sometime, but majority of time for me today).
|
but it is reproducible on a public codebase? that's a good enough start for me to reopen, thanks. |
yep, no need of specific fixture, checking out play master allow to reproduce it. |
I don't see an EOFException, just a hang, which appears to be in the application/test code and not in sbt. The relevant stack traces from the remote jvm: "specs2.DefaultExecutionStrategy1" prio=10 tid=0x00007fddf83e4000 nid=0xfbf in Object.wait() [0x00007fddf4de8000]
java.lang.Thread.State: RUNNABLE
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at anorm.H2Database$class.withConnection(H2Database.scala:11)
at anorm.AnormSpec$.withConnection(AnormSpec.scala:9)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$1.apply(AnormSpec.scala:11)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$1.apply(AnormSpec.scala:11)
at org.specs2.specification.ContextsInjection$$anon$1$$anonfun$asResult$1.apply(ContextsInjection.scala:11)
"specs2.DefaultExecutionStrategy2" prio=10 tid=0x00007fddf8363000 nid=0xfc0 waiting for monitor entry [0x00007fddf4ce7000]
java.lang.Thread.State: BLOCKED (on object monitor)
at java.sql.DriverManager.registerDriver(DriverManager.java:295)
- waiting to lock <0x000000077bd95720> (a java.lang.Class for java.sql.DriverManager)
at org.h2.Driver.load(Driver.java:160)
- locked <0x000000077bdb25f0> (a java.lang.Class for org.h2.Driver)
at org.h2.Driver.<clinit>(Driver.java:45)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at anorm.H2Database$class.withConnection(H2Database.scala:11)
at anorm.AnormSpec$.withConnection(AnormSpec.scala:9)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$6.apply(AnormSpec.scala:24)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$6.apply(AnormSpec.scala:24)
at org.specs2.specification.ContextsInjection$$anon$1$$anonfun$asResult$1.apply(ContextsInjection.scala:11)
"specs2.DefaultExecutionStrategy3" prio=10 tid=0x00007fddf83e8800 nid=0xfc1 in Object.wait() [0x00007fddf4be6000]
java.lang.Thread.State: RUNNABLE
at acolyte.Acolyte$.connection(Acolyte.scala:37)
at anorm.AnormTest$class.withQueryResult(AnormSpec.scala:65)
at anorm.AnormSpec$.withQueryResult(AnormSpec.scala:9)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$11$$anonfun$apply$12.apply(AnormSpec.scala:37)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$11$$anonfun$apply$12.apply(AnormSpec.scala:37)
at org.specs2.specification.ContextsInjection$$anon$1$$anonfun$asResult$1.apply(ContextsInjection.scala:11)
"specs2.DefaultExecutionStrategy4" prio=10 tid=0x00007fddf8342000 nid=0xfc2 in Object.wait() [0x00007fddf4ae4000]
java.lang.Thread.State: RUNNABLE
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:374)
at java.lang.Class.newInstance(Class.java:327)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at java.sql.DriverManager$2.run(DriverManager.java:537)
at java.security.AccessController.doPrivileged(Native Method)
at java.sql.DriverManager.loadInitialDrivers(DriverManager.java:517)
at java.sql.DriverManager.initialize(DriverManager.java:650)
at java.sql.DriverManager.registerDriver(DriverManager.java:296)
- locked <0x000000077bd95720> (a java.lang.Class for java.sql.DriverManager)
at acolyte.Driver.<clinit>(Driver.java:41)
at acolyte.Acolyte$.connection(Acolyte.scala:37)
at anorm.AnormTest$class.withQueryResult(AnormSpec.scala:65)
at anorm.AnormSpec$.withQueryResult(AnormSpec.scala:9)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$11$$anonfun$apply$16.apply(AnormSpec.scala:45)
at anorm.AnormSpec$$anonfun$1$$anonfun$apply$11$$anonfun$apply$16.apply(AnormSpec.scala:45)
at org.specs2.specification.ContextsInjection$$anon$1$$anonfun$asResult$1.apply(ContextsInjection.scala:11)
at org.specs2.specification.ContextsInjection$$anon$1$$anonfun$asResult$1.apply(ContextsInjection.scala:11)
If you forcibly kill sbt, yes, I see an EOFException, but that's not surprising- it is being forcibly shutdown in the middle of communicating with a remove jvm. |
Do you see it ending at some point? if you don't kill? |
Right, you have to kill it. But, that's a problem with the tests themselves, not sbt. |
weird |
To be clear, the problem is that the tests hang. This means that the user has to kill sbt. During forcible termination, sbt generates a spurious exception that is unavoidable as far as I can see. So, I'm (re)closing this. |
@harrah I am on 0.13.0 and I am facing the same exception Exception in thread "Thread-18" java.io.EOFException I am just running a simple repeat loop in a test and this is what I get before the test completes. It's a multi-module Play project and I am on Scala 2.10.2 using ScalaTest. If I set the sbt.Keys.fork in Test := true I get till here. If I set it to false, the test silently exits without even throwing this exception. |
Gentlemen, we're still facing this, with sbt 0.12.2. Tests are succeeding, sbt is not forcibly terminated.
|
@aloiscochard no, we're using Specs2. |
I am facing the same issue with sbt 0.13.5 and specs2. If I set |
I am still facing issue when using fork in Test := true Can some one please suggest the fix. |
It might be network related folks. I can reproduce this test on my OSS project, http://github.com/spark-jobserver/spark-jobserver, master branch, which uses SBT 0.13.7, Scala 2.10.4, and ScalaTest, and forks tests .... IF I turn my VPN on, which screws up my localhost IP. In which case:
If I turn my VPN off, then all the tests pass. |
For me adding JVM memory options to build.sbt did the magic..somehow |
related to issues: sbt/sbt#653 travis-ci/travis-ci#3775
This seems to be the common fix. https://github.com/clulab/processors/pull/41/files sbt/sbt#653
Problem/Solution The Finatra TravisCI build is currently failing due to what looks like issues caused by: sbt/sbt#653 travis-ci/travis-ci#3775 Attempting the solution suggested in the latter issue and done here: nativelibs4java/scalaxy-streams@01ffbad RB_ID=901517 TBR=true
Seeing this with increasing regularity, typically in CID. |
We recently ran into a pretty severe issue where a ScalaTest test class was throwing a NPE during construction, which caused test execution to stop but for success to be reported. This meant that we were running 1/3 of our test suite instead of the full test suite and failures were not reported. Note that this was a multi-module build.
I can provide a simple test case if that helps.
The output was:
The text was updated successfully, but these errors were encountered: