zio / zio

ZIO — A type-safe, composable library for async and concurrent programming in Scala
https://zio.dev
Apache License 2.0
4.1k stars 1.3k forks source link

NPE in zio-test while rendering a Cause #4414

Open hmemcpy opened 3 years ago

hmemcpy commented 3 years ago

I've been getting occasional failures in CI with the following error:

Fiber failed.
An unchecked error was produced.
java.lang.NullPointerException
    at zio.Cause.causeToSequential$1(Cause.scala:343)
    at zio.Cause.prettyPrint(Cause.scala:376)
    at zio.test.FailureRenderer$.renderCause(DefaultTestReporter.scala:320)
    at zio.test.DefaultTestReporter$.renderCause(DefaultTestReporter.scala:129)
    at zio.test.DefaultTestReporter$.loop$1(DefaultTestReporter.scala:82)
  | => uat zio.test.DefaultTestReporter$.$anonfun$render$4(DefaultTestReporter.scala:61)
    at zio.test.DefaultTestReporter$$$Lambda$6912/000000005B5F8420.apply(Unknown Source)
    at scala.collection.StrictOptimizedIterableOps.flatMap(StrictOptimizedIterableOps.scala:117)
    at scala.collection.StrictOptimizedIterableOps.flatMap$(StrictOptimizedIterableOps.scala:104)
        ....

Rerunning the test makes it pass. I can't reproduce it consistently and I don't yet know what might be causing it - but this is a test that reads a text file from resources using Source.fromResource.

Upon initial glance the failing line in ZIO is: https://github.com/zio/zio/blob/0be5bb0265ff91983e761203d720047b21bdb042/core/shared/src/main/scala/zio/Cause.scala#L329-L330

Seems that error is null for some reason...

adamgfraser commented 3 years ago

@hmemcpy I think this may be related to #4384.