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

Complete promise from the locally submitted ack #1807

Merged
merged 4 commits into from Jul 12, 2019
Merged

Conversation

huntc
Copy link
Contributor

@huntc huntc commented Jul 3, 2019

Prior to this PR any acks to a PUBLISH could fail and have their failure swallowed (hidden). I now think that it is best to signal completions so that the calling code is able to act on them; as per the existing SUBACK completion mechanism. To illustrate:

  1. Publisher publishes PUBLISH with QoS 1
  2. Consumer receives the PUBLISH
  3. Machine is really slow (like my ancient single core Atom processor!)
  4. Consumer throws a ConsumeFailed given that 30 seconds (the former local ack timeout) has passed and it hasn't received a local PUBACK
  5. A PUBACK is then provided locally

Step 5 will result in there being no route to the Consumer as it previously stopped at step 4. The local calling code has no knowledge of this and assumes that life is normal.

The test changes illustrate how this mechanism works.

I've also increased the local ack timeout to reduce the chances of above timeout. Testing on my slow Atom based machine shows that the changes work.

huntc added 2 commits July 3, 2019 17:41
Prior to this commit any acks to a PUBLISH could fail and have their failure swallowed (hidden). I’m now thinking that it is best to propagate this particular type of failure so that the calling code is able to act on it To illustrate:

1. Publisher publishes PUBLISH with QoS 1
2. Consumer receives the PUBLISH
3. Machine is really slow
4. Consumer throws a ConsumeFailed given that 30 seconds (the local ack timeout) has passed and it hasn't received a local PUBACK
5. A PUBACK is then provided locally

Step 5 will result in there being no route to the Consumer as it previously stopped at step 4. The exception reflecting the inability to route was swallowed up.

It feels like an error to publish an ACK for something more than once, hence the change to propagate the error.
We increase the timeout default for slow acks given super slow machines
@huntc
Copy link
Contributor Author

huntc commented Jul 3, 2019

@longshorej WDYT? It appears to work for us.

This commit restores the behaviour to that of prior to this PR, but adds in the ability for the client API to receive a notification on the acks having completed - successfully or not. This new behaviour utilises the existing completion notification mechanism for server SubAcks.
@huntc huntc changed the title Error bad local acks and increase the local ack timeout Signal bad local acks and increase the local ack timeout Jul 4, 2019
@huntc
Copy link
Contributor Author

huntc commented Jul 4, 2019

Further to #1807 (comment), @longshorej and I chatted and concluded that a notification mechanism would be better than failing the stream. I've now updated the PR to use the existing SUBACK completion mechanism. I'm pretty happy with it, but will have another chat with Jason to get his feedback.

That's all of the acks now, for consistency.
@huntc huntc marked this pull request as ready for review July 5, 2019 00:36
@huntc
Copy link
Contributor Author

huntc commented Jul 5, 2019

I'm pretty happy with this PR now. Feel free to review/merge etc. There's no change to the existing behaviour other than the increased timeout. The PR mostly introduces a new feature whereby all types of locally submitted ack can now receive an additional completed promise parameter, which utilises existing API - so no API changes either.

Copy link
Contributor

@longshorej longshorej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful!

@huntc
Copy link
Contributor Author

huntc commented Jul 8, 2019

@ennru @2m This PR is ready for review. :-)

@huntc
Copy link
Contributor Author

huntc commented Jul 11, 2019

@2m Any chance we can get this merged? :-)

@2m
Copy link
Member

2m commented Jul 12, 2019

Sorry for the delay. Will review today.

@2m 2m changed the title Signal bad local acks and increase the local ack timeout Complete promise from the locally submitted ack Jul 12, 2019
@2m 2m added this to the 1.1.1 milestone Jul 12, 2019
Copy link
Member

@2m 2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@2m 2m merged commit a9660ed into akka:master Jul 12, 2019
@huntc huntc deleted the error-bad-acks branch July 12, 2019 20:59
@huntc
Copy link
Contributor Author

huntc commented Jul 12, 2019

Thanks @2m !

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

Successfully merging this pull request may close these issues.

None yet

3 participants