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

NullPointerException with Flow join #30138

Closed
JackyChan opened this issue Mar 20, 2021 · 4 comments
Closed

NullPointerException with Flow join #30138

JackyChan opened this issue Mar 20, 2021 · 4 comments
Assignees
Labels
3 - in progress Someone is working on this ticket t:stream
Milestone

Comments

@JackyChan
Copy link

It seems that a bug with Flow.join operation. Try to run following code.

val f1 = Flow[Int].fold(0)(_+_)
val f2 = Flow[Int].fold(0)(_+_)
f1.join(f2).toString

Would output:

java.lang.NullPointerException
  akka.stream.Attributes$SourceLocation.locationName$lzycompute(Attributes.scala:319)
  akka.stream.Attributes$SourceLocation.locationName(Attributes.scala:311)
  akka.stream.Attributes$SourceLocation.toString(Attributes.scala:322)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterable.addString(Iterable.scala:920)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterable.mkString(Iterable.scala:920)
  scala.collection.Iterable.toString(Iterable.scala:76)
  scala.collection.Iterable.toString$(Iterable.scala:76)
  scala.collection.Seq.toString(Seq.scala:49)
  scala.collection.Seq.toString$(Seq.scala:49)
  scala.collection.AbstractSeq.toString(Seq.scala:1154)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.Attributes.toString(Attributes.scala:36)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.impl.PushAttributes.toString(TraversalBuilder.scala:178)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.impl.Concat.toString(TraversalBuilder.scala:93)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.impl.Concat.toString(TraversalBuilder.scala:93)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1194)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.impl.Concat.toString(TraversalBuilder.scala:93)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1194)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.impl.LinearTraversalBuilder.toString(TraversalBuilder.scala:735)
  java.lang.String.valueOf(String.java:2994)
  java.lang.StringBuilder.append(StringBuilder.java:131)
  scala.collection.IterableOnceOps.addString(IterableOnce.scala:1191)
  scala.collection.IterableOnceOps.addString$(IterableOnce.scala:1186)
  scala.collection.AbstractIterator.addString(Iterator.scala:1279)
  scala.collection.IterableOnceOps.mkString(IterableOnce.scala:1136)
  scala.collection.IterableOnceOps.mkString$(IterableOnce.scala:1134)
  scala.collection.AbstractIterator.mkString(Iterator.scala:1279)
  scala.runtime.ScalaRunTime$._toString(ScalaRunTime.scala:159)
  akka.stream.scaladsl.RunnableGraph.toString(Flow.scala:727)
  ammonite.$sess.cmd64$.<clinit>(cmd64.sc:1)
@johanandren johanandren self-assigned this Mar 22, 2021
@johanandren johanandren added 0 - new Ticket is unclear on it's purpose or if it is valid or not t:stream labels Mar 22, 2021
@johanandren
Copy link
Member

Hi, I tried this on JDK 11 (11.0.8+10) and JDK 8 (1.8.0_272) which are the bounds of what we support, and it works fine. Do you have some additional details about your environment that could be the cause?

I still think it should be fixed, and just ignore providing the source location if not possible, but it would be good to be able to verify that a fix actually does something.

@JackyChan
Copy link
Author

Hi, I tried this on JDK 11 (11.0.8+10) and JDK 8 (1.8.0_272) which are the bounds of what we support, and it works fine. Do you have some additional details about your environment that could be the cause?

I still think it should be fixed, and just ignore providing the source location if not possible, but it would be good to be able to verify that a fix actually does something.

My environment is MacOS 11.2.3, Scala 2.13.5, GraalVM 21, JDK 1.8.0_282, Akka Stream 2.6.13

Screen Shot 2021-03-22 at 5 18 16 PM

Screen Shot 2021-03-22 at 5 16 14 PM

@johanandren
Copy link
Member

johanandren commented Mar 22, 2021

Interesting, that could mean that the source line extraction logic is broken in latest JDK 8 patch release but not before that (note I tried on _272 while you are on _282) so perhaps something more to do there than just making it not fail.

Edit: oh wait, GraalVM, that is probably the reason, so the catch-silence should fix that.

@johanandren johanandren added 3 - in progress Someone is working on this ticket and removed 0 - new Ticket is unclear on it's purpose or if it is valid or not labels Mar 22, 2021
@JackyChan
Copy link
Author

Yeah, it seems relate to the JDK. It running fine with GraalVM 21 Java 11.0.10.

Screen Shot 2021-03-23 at 9 13 52 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 - in progress Someone is working on this ticket t:stream
Projects
None yet
Development

No branches or pull requests

2 participants