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

Propagate service error when gracefully shutting down #152

Merged
merged 1 commit into from
Aug 22, 2023

Conversation

FranzBusch
Copy link
Contributor

Motivation

Propagate the service error when we shutdown the group after the service threw.

@@ -338,6 +338,7 @@ public actor ServiceGroup: Sendable {
group: &group,
gracefulShutdownManagers: gracefulShutdownManagers
)
return .failure(error)
} catch {
return .failure(error)
Copy link

Choose a reason for hiding this comment

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

This is a different error, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is the error if the group fails to shutdown. What do you expect here? The error from the original service that threw or the error during shutdown?

Copy link

Choose a reason for hiding this comment

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

I would expect the original service error. Basically, the first service that fails. Makes debugging easier, because cleanup code is frequently buggy so benign errors are likely going to be masked by broken shutdown code elsewhere if we do use the last error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. We are also logging that another service threw during shutdown and what error it threw.

# Motivation

Propagate the service error when we shutdown the group after the service threw.
@FranzBusch FranzBusch force-pushed the fb-fix-throw-gracefulshutdown branch from efff8de to 6e92f03 Compare August 22, 2023 19:52
@FranzBusch FranzBusch merged commit 98a9396 into main Aug 22, 2023
@FranzBusch FranzBusch deleted the fb-fix-throw-gracefulshutdown branch August 22, 2023 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants