Skip to content
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

Error java.util.NoSuchElementException: None.get after upgrade Stryker version to 0.14.x #1042

Open
tanyagorn opened this issue Dec 22, 2021 · 8 comments

Comments

@tanyagorn
Copy link

Summary

Almost all of my projects cannot upgrade Stryker version to 0.14.x, they still remain as 0.13.1 due to receiving

[error] stack trace is suppressed; run last stryker for the full output
[error] (stryker) java.util.NoSuchElementException: None.get

and run last stryker didn't give me more clue though

[error] java.util.NoSuchElementException: None.get
[error] 	at scala.None$.get(Option.scala:529)
[error] 	at scala.None$.get(Option.scala:527)
[error] 	at stryker4s.sbt.runner.SocketTestRunnerConnection.$anonfun$sendMessage$5(TestRunnerConnection.scala:22)
[error] 	at joinWithNever @ fs2.Stream$NestedStreamOps$.$anonfun$parJoin$44(Stream.scala:4057)
[error] 	at flatTap @ stryker4s.mutants.Mutator.mutate(Mutator.scala:37)
[error] 	at joinWithNever @ fs2.Stream$NestedStreamOps$.$anonfun$parJoin$44(Stream.scala:4057)
[error] (stryker) java.util.NoSuchElementException: None.get

You can check this example repo to try it out -> https://github.com/tanyagorn/scala-play-realworld-example-app

Stryker4s config

stryker4s {
    mutate: [ "app/**/*.scala" ]
}

Stryker4s environment

stryker4s 0.14.x

Your Environment

software version(s)
Scala version 2.13
Build tool & version Intellij Idea community 2021.1.3 (community edition)
Operating System macOS
@hugo-vrijswijk
Copy link
Member

hugo-vrijswijk commented Dec 22, 2021

Hi! Thanks for opening this issue. I think this issue might be related to Java versions.

I can reproduce this issue by running Stryker with extra debug logging on the linked project with JDK 17, and see this in the output:

[debug] testrunner 13337: Test unsuccessful: users.controllers.UserUpdateTest status Error with OptionalThrowable(java.lang.IllegalAccessError: class com.typesafe.sslconfig.ssl.FakeKeyStore$KeystoreSettings$ (in unnamed module @0x5274766b) cannot access class sun.security.x509.AlgorithmId (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @0x5274766b)
[debug] testrunner 13337: Fatal exception reported by testrunner. Re-throwing java.lang.IllegalAccessError: class com.typesafe.sslconfig.ssl.FakeKeyStore$KeystoreSettings$ (in unnamed module @0x5274766b) cannot access class sun.security.x509.AlgorithmId (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @0x5274766b
[debug] testrunner 13337: Exception in thread "main" java.lang.IllegalAccessError: class com.typesafe.sslconfig.ssl.FakeKeyStore$KeystoreSettings$ (in unnamed module @0x5274766b) cannot access class sun.security.x509.AlgorithmId (in module java.base) because module java.base does not export sun.security.x509 to unnamed module @0x5274766b
[debug] testrunner 13337:       at com.typesafe.sslconfig.ssl.FakeKeyStore$KeystoreSettings$.<clinit>(FakeKeyStore.scala:55)
[debug] testrunner 13337:       at com.typesafe.sslconfig.ssl.FakeKeyStore$.generateKeyStore(FakeKeyStore.scala:71)
[debug] testrunner 13337:       at play.core.server.SelfSigned$.x$1$lzycompute(SelfSigned.scala:23)
[debug] testrunner 13337:       at play.core.server.SelfSigned$.x$1(SelfSigned.scala:22)
[debug] testrunner 13337:       at play.core.server.SelfSigned$.sslContext$lzycompute(SelfSigned.scala:22)

This looks related to some outdated libraries that don't properly work with the latest JDK. When I use JDK 11 or 8 Stryker4s runs fine without any errors. What JDK are you trying to run Stryker4s with? And is it possible there are other versions of your JDK installed that might be picked up?

If this doesn't sound like your issue, could you try adding debug { log-test-runner-stdout: true } to your stryker4s.conf and calling Stryker4s with debug logging by running sbt set stryker / logLevel := Level.Debug; stryker and seeing what extra logs you get?

Lastly, I think we can also improve on error logging with this. Because like you said NoSuchElementException: None.get is not very useful at all

@tanyagorn
Copy link
Author

I use JDK 8 on Stryker4s run, and it still give me errors. Enable debug as your suggestion helps me find unsuccessful tests. However, how could they be unsuccessful tests? All tests in the project are fine when I run sbt test.

It just doesn't feel right when I need to exclude unsuccessful tests out while running Stryker. The accuracy of mutation test result won't be correct, since the tests actually exist and some of mutants could have been killed by them.

@hugo-vrijswijk
Copy link
Member

Definitely, as many tests as possible should run under Stryker4s. Could you provide any information about the test error message? That might help in finding the issue

@ayush9999-qa
Copy link

ayush9999-qa commented Jan 5, 2022

@hugo-vrijswijk
I am also getting the same error in some of the modules after upgrading from 0.13.1 to 0.41.1:

[error] java.util.NoSuchElementException: None.get
[error] 	at scala.None$.get(Option.scala:529)
[error] 	at scala.None$.get(Option.scala:527)
[error] 	at stryker4s.sbt.runner.SocketTestRunnerConnection.$anonfun$sendMessage$5(TestRunnerConnection.scala:22)
[error] 	at unsafeRunSync @ stryker4s.sbt.Stryker4sMain$.$anonfun$strykerTask$1(Stryker4sMain.scala:55)
[error] 	at joinWithNever @ stryker4s.sbt.runner.SocketTestRunnerConnection.$anonfun$skipCancel$1(TestRunnerConnection.scala:31)
[error] 	at flatMap @ stryker4s.sbt.runner.SocketTestRunnerConnection.skipCancel(TestRunnerConnection.scala:31)
[error] 	at map @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:22)
[error] 	at map @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:23)
[error] 	at flatTap @ stryker4s.mutants.Mutator.mutate(Mutator.scala:37)
[error] 	at unsafeRunSync @ stryker4s.sbt.Stryker4sMain$.$anonfun$strykerTask$1(Stryker4sMain.scala:55)
[error] 	at joinWithNever @ stryker4s.sbt.runner.SocketTestRunnerConnection.$anonfun$skipCancel$1(TestRunnerConnection.scala:31)
[error] 	at flatMap @ stryker4s.sbt.runner.SocketTestRunnerConnection.skipCancel(TestRunnerConnection.scala:31)
[error] 	at apply @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:19)
[error] (stryker) java.util.NoSuchElementException: None.get
[error] Total time: 16 s, completed Jan 5, 2022 4:59:07 PM

Didn't seem to get unsuccessful test even by putting log in conf file.
PS. I was not getting this issue with v0.13.1

@ayush9999-qa
Copy link

ayush9999-qa commented Feb 9, 2022

@hugo-vrijswijk Any suggestions on this one?

@neritae
Copy link

neritae commented Mar 3, 2022

@hugo-vrijswijk I also got this but with scalapb. Is version 14 compatible with Scala Protocol Buffer from com.thesamet.scalapb:lenses_2.12:0.9.8?

JDK: java version "11.0.13" 2021-10-19 LTS

[debug] testrunner 13338: Caused by: java.lang.ClassNotFoundException: scalapb.Message
[debug] testrunner 13338: 	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
[debug] testrunner 13338: 	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
[debug] testrunner 13338: 	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
[debug] testrunner 13338: 	... 49 more
[debug] Closing test-runner on port 13338
[debug] Closing test-runner on port 13337
[error] java.util.NoSuchElementException: None.get
[error] 	at scala.None$.get(Option.scala:529)
[error] 	at scala.None$.get(Option.scala:527)
[error] 	at stryker4s.sbt.runner.SocketTestRunnerConnection.$anonfun$sendMessage$5(TestRunnerConnection.scala:22)
[error] 	at unsafeRunSync @ stryker4s.sbt.Stryker4sMain$.$anonfun$strykerTask$1(Stryker4sMain.scala:55)
[error] 	at joinWithNever @ fs2.Stream$NestedStreamOps$.$anonfun$parJoin$44(Stream.scala:4054)
[error] 	at flatMap @ stryker4s.sbt.runner.SocketTestRunnerConnection.skipCancel(TestRunnerConnection.scala:31)
[error] 	at map @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:22)
[error] 	at map @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:23)
[error] 	at flatTap @ stryker4s.mutants.Mutator.mutate(Mutator.scala:37)
[error] 	at unsafeRunSync @ stryker4s.sbt.Stryker4sMain$.$anonfun$strykerTask$1(Stryker4sMain.scala:55)
[error] 	at joinWithNever @ fs2.Stream$NestedStreamOps$.$anonfun$parJoin$44(Stream.scala:4054)
[error] 	at flatMap @ stryker4s.sbt.runner.SocketTestRunnerConnection.skipCancel(TestRunnerConnection.scala:31)
[error] 	at apply @ stryker4s.sbt.runner.SocketTestRunnerConnection.sendMessage(TestRunnerConnection.scala:19)
[error] (stryker) java.util.NoSuchElementException: None.get

@neritae
Copy link

neritae commented Mar 3, 2022

@hugo-vrijswijk
Copy link
Member

@ayush9999-qa sorry for the delayed response, if you're able to add test-runner log output to this issue it is easier for me to debug. Otherwise, I'm not sure if I can help as I wasn't able to really debug the provided repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants