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

Handle soft errors gracefully #810

Merged
merged 1 commit into from
Apr 5, 2022

Conversation

nazar-pc
Copy link
Collaborator

@nazar-pc nazar-pc commented Apr 4, 2022

In Rust all of the communication with worker is heavily asynchronous and even multi-threaded, there is no direct way to guarantee order of messages except creating an explicit queue. This sometimes leads to situations where consumer is closed after transport (since everything is dropped and multiple close requests are racing for completion on worker with each other and might be delivered in any order) for instance.

Such situations produce unhelpful error messages that these changes will suppress and turn into success. If something tries to close consumer that doesn't exist on worker anyway, it is now treated as successful completion (similarly to idempotent HTTP method DELETE).

@Hartigan
Copy link

Hartigan commented Apr 4, 2022

@nazar-pc Consumer::get_stats generates many errors too, even with Consumer::closed checks. Will all such consumer not found be fixed?

@nazar-pc
Copy link
Collaborator Author

nazar-pc commented Apr 5, 2022

I don't think so. Racing during closing is something that user of the library doesn't control. The rest is user-controlled, so should be preventable. I don't recall immediately why producer isn't owned by consumer so it is not closed automatically, maybe I'll add that later. For something like get_stats there isn't really a reasonable default value to return either.

Having heavier typing for errors would be nice, but that might be a lot of work.

@nazar-pc
Copy link
Collaborator Author

nazar-pc commented Apr 5, 2022

Merging as is for now, I'll see what other improvements can be done about similar situations

@nazar-pc nazar-pc merged commit 1affe94 into versatica:v3 Apr 5, 2022
@nazar-pc nazar-pc deleted the graceful-soft-error-handling branch April 5, 2022 21:34
@jmillan
Copy link
Member

jmillan commented Apr 7, 2022

👍

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

Successfully merging this pull request may close these issues.

None yet

4 participants