-
Notifications
You must be signed in to change notification settings - Fork 124
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
Null pointer exception when running akka-grpc related tests #1014
Comments
Thanks for sharing, this is very interesting/puzzling. It reminds me a lot of akka/akka-http#3221, which I haven't been able to reproduce so far. It would be great if you could somehow help reliably recreate the issue. |
Right - but the question is how could it be null? I'm not sure what version of akka-http you're running, but in all versions the |
Until we have a reproducer, let's at least collect other information: what versions of sbt, akka-http and Scala are you running? |
The project the issue occurs is a commercial project. Currently I try to build a reproducer at home, but now I hit this issue: #946 The project at work uses Scala 2.13.2 and SBT 1.3.12. The Projects depends on Play 2.8.1 so it uses Akka HTTP 10.1.11. |
Perhaps the quick way out would be to run without HTTPS? |
@raboof I've a reproducible test case: https://github.com/akkie/akka-grpc-1014 The test contains two test cases. The first |
Great, that indeed reproduces it! I'll have a look. |
👻 👻 👻 the mystery... the suspense... |
Indeed, in ASpec, |
Even a project with just akka-actor as a dependency:
reproduces the problem. Definitely looks like an initialization order issue. |
It is, I annotated running the object initializers, and dump the stack from where
That line
is sealed abstract class ByteString
extends IndexedSeq[Byte]
with IndexedSeqOps[Byte, IndexedSeq, ByteString]
with StrictOptimizedSeqOps[Byte, IndexedSeq, ByteString] {
override protected def fromSpecific(coll: IterableOnce[Byte]): ByteString = ByteString(coll)
override protected def newSpecificBuilder: mutable.Builder[Byte, ByteString] = ByteString.newBuilder
override val empty: ByteString = ByteString.empty // <- this line introduces the cycle |
@akkie so the short-term workaround could be to make sure you touch |
This line was introduced for the 2.13 version of The question is: are there other cycles that we don't know about? |
Thanks, the workaround works 👍 |
This is now also fixed upstream, so if you're on Akka 2.6.7 or later you should no longer need the workaround. |
Versions used
Akka gRPC: 0.8.4
Play gRPC: 0.8.4
Akka version: 2.6.5
Expected Behavior
Running tests should not end in a null pointer exception
Actual Behavior
This is a really strange behavior. If I run multiple tests with
sbt test
I get the following exception:Akka gRPC creates handler classes with the following content. Line 24 is the line that defines the
notFound
response.If I run the test with
testOnly routers.DeploymentRouterSpec
, the test runs without issues. I've different routers each covered with a test. The issues is always the same. If i run all tests, all the akka gRPC related tests fails. If I run each gRPC related test independently, every test completes without an issue.The root cause is, that the
data: ByteString
param defined onHttpEntity.Strict
is null if I run all the tests.The text was updated successfully, but these errors were encountered: