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

LogRotatorSink does not terminate when consuming an empty Source #1701

Closed
samidalouche opened this issue May 14, 2019 · 3 comments
Closed

LogRotatorSink does not terminate when consuming an empty Source #1701

samidalouche opened this issue May 14, 2019 · 3 comments
Milestone

Comments

@samidalouche
Copy link
Contributor

Versions used

Latest master . commit : a072527
Same problem with alpakka 1.0.0 / akka 2.5.22

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  "LogRotatorSink" must {

    "work with empty sources" in assertAllStagesStopped {
      val triggerCreator: () => ByteString => Option[Path] = () => { element: ByteString =>
        ??? // never called, doesn't matter
      }

      val rotatorSink: Sink[ByteString, Future[Done]] =
        LogRotatorSink(triggerCreator)

      val fileSizeCompletion = Source.empty[ByteString].runWith(rotatorSink)
      fileSizeCompletion.futureValue shouldBe Done
    }
 ...
}

Actual Behavior

Please provide a description of what actually happens, working from the same starting point.

[info] - must work with empty sources *** FAILED *** (5 seconds, 198 milliseconds)
[info]   A timeout occurred waiting for a future to complete. Queried 50 times, sleeping 100000000 nanoseconds between each query. (LogRotatorSinkSpec.scala:95)
[info]   org.scalatest.concurrent.Futures$FutureConcept$$anon$1:
[info]   at org.scalatest.concurrent.Futures$FutureConcept.tryTryAgain$1(Futures.scala:538)
[info]   at org.scalatest.concurrent.Futures$FutureConcept.futureValueImpl(Futures.scala:550)
[info]   at org.scalatest.concurrent.Futures$FutureConcept.futureValueImpl$(Futures.scala:479)
[info]   at org.scalatest.concurrent.ScalaFutures$$anon$1.futureValueImpl(ScalaFutures.scala:275)
[info]   at org.scalatest.concurrent.Futures$FutureConcept.futureValue(Futures.scala:476)
[info]   at org.scalatest.concurrent.Futures$FutureConcept.futureValue$(Futures.scala:475)
[info]   at org.scalatest.concurrent.ScalaFutures$$anon$1.futureValue(ScalaFutures.scala:275)
[info]   at docs.scaladsl.LogRotatorSinkSpec.$anonfun$new$3(LogRotatorSinkSpec.scala:95)
[info]   at akka.stream.testkit.scaladsl.StreamTestKit$.assertAllStagesStopped(StreamTestKit.scala:32)
[info]   at docs.scaladsl.LogRotatorSinkSpec.$anonfun$new$2(LogRotatorSinkSpec.scala:86)
[info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
[info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
[info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
[info]   at org.scalatest.Transformer.apply(Transformer.scala:22)
[info]   at org.scalatest.Transformer.apply(Transformer.scala:20)
[info]   at org.scalatest.WordSpecLike$$anon$3.apply(WordSpecLike.scala:1075)
[info]   at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)
[info]   at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)
[info]   at docs.scaladsl.LogRotatorSinkSpec.withFixture(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.WordSpecLike.invokeWithFixture$1(WordSpecLike.scala:1073)
[info]   at org.scalatest.WordSpecLike.$anonfun$runTest$1(WordSpecLike.scala:1085)
[info]   at org.scalatest.SuperEngine.runTestImpl(Engine.scala:286)
[info]   at org.scalatest.WordSpecLike.runTest(WordSpecLike.scala:1085)
[info]   at org.scalatest.WordSpecLike.runTest$(WordSpecLike.scala:1067)
[info]   at docs.scaladsl.LogRotatorSinkSpec.runTest(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.WordSpecLike.$anonfun$runTests$1(WordSpecLike.scala:1144)
[info]   at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:393)
[info]   at scala.collection.immutable.List.foreach(List.scala:388)
[info]   at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:381)
[info]   at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:370)
[info]   at org.scalatest.SuperEngine.$anonfun$runTestsInBranch$1(Engine.scala:407)
[info]   at scala.collection.immutable.List.foreach(List.scala:388)
[info]   at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:381)
[info]   at org.scalatest.SuperEngine.runTestsInBranch(Engine.scala:376)
[info]   at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:458)
[info]   at org.scalatest.WordSpecLike.runTests(WordSpecLike.scala:1144)
[info]   at org.scalatest.WordSpecLike.runTests$(WordSpecLike.scala:1143)
[info]   at docs.scaladsl.LogRotatorSinkSpec.runTests(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.Suite.run(Suite.scala:1124)
[info]   at org.scalatest.Suite.run$(Suite.scala:1106)
[info]   at docs.scaladsl.LogRotatorSinkSpec.org$scalatest$WordSpecLike$$super$run(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.WordSpecLike.$anonfun$run$1(WordSpecLike.scala:1189)
[info]   at org.scalatest.SuperEngine.runImpl(Engine.scala:518)
[info]   at org.scalatest.WordSpecLike.run(WordSpecLike.scala:1189)
[info]   at org.scalatest.WordSpecLike.run$(WordSpecLike.scala:1187)
[info]   at docs.scaladsl.LogRotatorSinkSpec.org$scalatest$BeforeAndAfterAll$$super$run(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.BeforeAndAfterAll.liftedTree1$1(BeforeAndAfterAll.scala:213)
[info]   at org.scalatest.BeforeAndAfterAll.run(BeforeAndAfterAll.scala:210)
[info]   at org.scalatest.BeforeAndAfterAll.run$(BeforeAndAfterAll.scala:208)
[info]   at docs.scaladsl.LogRotatorSinkSpec.run(LogRotatorSinkSpec.scala:30)
[info]   at org.scalatest.tools.Framework.org$scalatest$tools$Framework$$runSuite(Framework.scala:317)
[info]   at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:510)
[info]   at sbt.TestRunner.runTest$1(TestFramework.scala:113)
[info]   at sbt.TestRunner.run(TestFramework.scala:124)
[info]   at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.$anonfun$apply$1(TestFramework.scala:282)
[info]   at sbt.TestFramework$.sbt$TestFramework$$withContextLoader(TestFramework.scala:246)
[info]   at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.apply(TestFramework.scala:282)
[info]   at sbt.TestFramework$$anon$2$$anonfun$$lessinit$greater$1.apply(TestFramework.scala:282)
[info]   at sbt.TestFunction.apply(TestFramework.scala:294)
[info]   at sbt.Tests$.$anonfun$toTask$1(Tests.scala:309)
[info]   at sbt.std.Transform$$anon$3.$anonfun$apply$2(System.scala:46)
[info]   at sbt.std.Transform$$anon$4.work(System.scala:67)
[info]   at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[info]   at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[info]   at sbt.Execute.work(Execute.scala:278)
[info]   at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[info]   at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[info]   at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[info]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[info]   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[info]   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[info]   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[info]   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[info]   at java.lang.Thread.run(Thread.java:748)

Reproducible Test Case

The above test case can be copy pasted in LogRotatingSink.spec

@ennru
Copy link
Member

ennru commented May 15, 2019

Thanks for report the bug with this edge case. Would you like to suggest a PR for fixing it?

@samidalouche samidalouche changed the title LogRotatorSink does not terminate when fed an empty Source LogRotatorSink does not terminate when consuming an empty Source May 15, 2019
@samidalouche
Copy link
Contributor Author

Thanks for report the bug with this edge case. Would you like to suggest a PR for fixing it?

Sure. Here is my take at fixing the bug PR: #1703

@ennru ennru added this to the 1.0.1 milestone May 15, 2019
@ennru
Copy link
Member

ennru commented May 15, 2019

Fixed with #1703

@ennru ennru closed this as completed May 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants