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

[Failed] CommittingWithMockSpec should collect commits to be sent to commitAsync #895

Open
ennru opened this issue Sep 5, 2019 · 10 comments · Fixed by #1104
Open

[Failed] CommittingWithMockSpec should collect commits to be sent to commitAsync #895

ennru opened this issue Sep 5, 2019 · 10 comments · Fixed by #1104
Labels

Comments

@ennru
Copy link
Member

ennru commented Sep 5, 2019

[info] CommittingWithMockSpec:

[info] - should commit metadata in message (469 milliseconds)

[info] - should call commitAsync for commit message and then complete future (228 milliseconds)

[info] - should fail future in case of commit fail (220 milliseconds)

[info] - should collect commits to be sent to commitAsync *** FAILED *** (10 seconds, 101 milliseconds)

[info]   java.util.concurrent.TimeoutException: Futures timed out after [10 seconds]

[info]   at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:259)

[info]   at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:263)

[info]   at scala.concurrent.Await$.$anonfun$result$1(package.scala:220)

[info]   at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:57)

[info]   at scala.concurrent.Await$.result(package.scala:146)

[info]   at akka.kafka.internal.CommittingWithMockSpec.$anonfun$new$13(CommittingWithMockSpec.scala:229)

https://travis-ci.org/akka/alpakka-kafka/jobs/581091376#L827

@ennru ennru added the failed label Sep 5, 2019
@seglo
Copy link
Contributor

seglo commented Oct 2, 2019

@seglo
Copy link
Contributor

seglo commented Oct 10, 2019

@seglo
Copy link
Contributor

seglo commented Jan 22, 2020

@ennru
Copy link
Member Author

ennru commented Jan 23, 2020

@ennru
Copy link
Member Author

ennru commented Feb 10, 2020

@ignasi35
Copy link
Contributor

ignasi35 commented Feb 10, 2020

I think the problem is on :

withClue("the commits are aggregated to a low number of calls to commitAsync:") {
awaitAssert {
val callsToCommitAsync = commitLog.calls.size
callsToCommitAsync should be >= 1
callsToCommitAsync should be < count / 10
}
}

It's a block that attempts to wait until all the commits have been submitted by counting how many callbacks were registered. The invocations to commitAsync may group messages so that block doesn't await until 100 callbacks are registered, and, instead, blocks until a few have been registered. In slow VM's this barrier is open when 1 or 2 callbacks have been registered but a lot more are still missing.

The consequence is that emulating the commit:

//emulate commit
commitLog.calls.foreach {
case (offsets, callback) => callback.onComplete(offsets.asJava, null)
}
allCommits.futureValue should have size (count.toLong)
control.shutdown().futureValue shouldBe Done
}

then is not invoking all the callbacks but just the first few blocks (the fast ones).

This leaves a handful of messages uncommited causing the test to fail.

This can be reproduced locally commenting the await block:

//    withClue("the commits are aggregated to a low number of calls to commitAsync:") {
//      awaitAssert {
//        val callsToCommitAsync = commitLog.calls.size
//        callsToCommitAsync should be >= 1
//        callsToCommitAsync should be < count / 10
//      }
//    }

@ignasi35
Copy link
Contributor

Fixed (?) in #1047. We can reopen if the issue is not solved completely.

@ennru ennru closed this as completed Feb 11, 2020
@ennru
Copy link
Member Author

ennru commented Apr 14, 2020

It shows in a new variant in master:

- should collect commits to be sent to commitAsync *** FAILED *** (1 minute, 40 seconds)
  the commits are aggregated to a low number of calls to commitAsync: 11 was not less than 10 (CommittingWithMockSpec.scala:223)
  org.scalatest.exceptions.TestFailedException:
  at org.scalatest.MatchersHelper$.indicateFailure(MatchersHelper.scala:343)
  at org.scalatest.Matchers$ShouldMethodHelper$.shouldMatcher(Matchers.scala:6723)
  at org.scalatest.Matchers$AnyShouldWrapper.should(Matchers.scala:6759)
  at akka.kafka.internal.CommittingWithMockSpec.$anonfun$new$18(CommittingWithMockSpec.scala:223)

https://travis-ci.org/github/akka/alpakka-kafka/jobs/674754524#L660

@ennru ennru reopened this Apr 14, 2020
@ennru ennru removed this from the 2.0.2 milestone Apr 14, 2020
@ignasi35 ignasi35 self-assigned this Apr 15, 2020
@ennru ennru added this to the 2.0.3 milestone May 13, 2020
@seglo
Copy link
Contributor

seglo commented Jun 11, 2020

It's back.

https://travis-ci.org/github/akka/alpakka-kafka/jobs/696759317#L626

--> [akka.kafka.internal.CommittingWithMockSpec: should collect commits to be sent to commitAsync] Start of log messages of test that [Failed(org.scalatest.exceptions.TestFailedException: the commits are aggregated to a low number of calls to commitAsync: 13 was not less than 10)]

@seglo seglo reopened this Jun 11, 2020
@seglo seglo removed this from the 2.0.3 milestone Jun 11, 2020
@ignasi35 ignasi35 removed their assignment Jul 14, 2020
@seglo
Copy link
Contributor

seglo commented Aug 18, 2020

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

Successfully merging a pull request may close this issue.

3 participants