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

Unable to determine which orderingKeys need resumePublishing #1524

Closed
mgabeler-lee-6rs opened this issue Apr 18, 2022 · 5 comments
Closed

Unable to determine which orderingKeys need resumePublishing #1524

mgabeler-lee-6rs opened this issue Apr 18, 2022 · 5 comments
Assignees
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@mgabeler-lee-6rs
Copy link
Contributor

Environment details

  • OS: Linux (but N/A)
  • Node.js version: 14.x (but N/A)
  • npm version: N/A
  • @google-cloud/pubsub version: v2.19.0

Steps to reproduce

  1. Induce or wait for errors on a publisher when using orderingKeys
  2. Try to figure out which ordering keys need a call to resumePublishing
  3. Discover that you cannot, at least not without reaching fingers into private members & implementation details

Details

The resumePublishing API is difficult and frustrating to use:

  • There is no way to find which ordering keys need the resume, if you want to do a "full reset"
  • Once a queue has an error, it doesn't emit a drain event, and so it stays in memory forever, but with no way to find out it is there and clear the error

Related Issues

I discovered this when investigating why my applications are affected by issues very similar to #1425 and #1462, and strange behaviors observed on retries.

@mgabeler-lee-6rs mgabeler-lee-6rs added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Apr 18, 2022
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the googleapis/nodejs-pubsub API. label Apr 18, 2022
@feywind
Copy link
Collaborator

feywind commented Apr 3, 2023

I could've sworn we had a discussion about this one too... sorry to keep pinging you, but @kamalaboulhosn ?

@feywind feywind added priority: p3 Desirable enhancement or fix. May not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Apr 3, 2023
@kamalaboulhosn
Copy link
Contributor

The promise returned from a publish call would have to be tracked along with its ordering key. For any publish with an ordering key for which the message failed, it would be necessary to call resumePublish.

@mgabeler-lee-6rs
Copy link
Contributor Author

That's still prone to race conditions. You also need to know that there isn't any code in the process of enqueuing multiple sequential publish calls. If you resumePublish in the middle of that, it will cause out-of-order publishes to happen. I'm not sure there's anything this library can do about that, just calling out that proper implementation of an ordered publisher is ... surprisingly complicated.

@kamalaboulhosn
Copy link
Contributor

Yes, there are definitely some subtleties. We do have a prober written in Java that endeavors to provide an example of how to do it well: https://github.com/GoogleCloudPlatform/pubsub/tree/master/ordering-keys-prober.

@kamalaboulhosn
Copy link
Contributor

Since this is not specific to Node, I have created an issue in the public issue tracker to keep track of it: https://issuetracker.google.com/issues/288118039. However, at this time, there is no timeline for if and when we may provide this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the googleapis/nodejs-pubsub API. priority: p3 Desirable enhancement or fix. May not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants