-
Notifications
You must be signed in to change notification settings - Fork 49
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
fix(rt): enforce only once shutdown logic for crt engine connections #497
Conversation
fixes: #413 Fixes the segfault that can happen when an exception is handled twice leading to a connection being closed after it has been free'd. This change refactors the handling of the connection close logic to be handled in a single place regardless of why the connection is being closed.
A new generated diff is ready to view: __generated-main...__generated-fix-413 |
A new generated diff is ready to view: __generated-main...__generated-fix-413 |
val forceClose = !streamCompleted | ||
|
||
if (forceClose) { | ||
logger.trace { "stream did not complete before job, forcing connection shutdown! handler=$this; conn=$conn; stream=$crtStream" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment
Perhaps this should be a higher level message, like warn
. From past experience it is often useful to know when partial results where received.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't necessarily mean partial results though. Technically it just means the coroutine job completed before consuming the entire response which could happen because of an exception or simply because the consumer doesn't read the entire body.
If we actually had a stream cancellation API then we wouldn't need to force close the connection which would make this less heavy handed.
I don't think I'd make it warn
because in the case of an exception they'll be forced to handle it anyway and the exception is your signal. In the case of explicitly not consuming the entire body it's not a warning since the consumer is choosing it. Perhaps debug
would be better than trace
though?
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
A new generated diff is ready to view: __generated-main...__generated-fix-413 |
Issue #
fixes #413
Description of changes
Fixes the segfault that can happen when an exception is handled twice leading to a connection being closed after it has been free'd. This change refactors the handling of the connection close logic to be handled in a single place regardless of why the connection is being closed.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.