[INLONG-12199][SDK] Fix the issue where sending on an already-closed channel during shutdown causes a panic in Dataproxy Go SDK - #12206
Open
yfsn666 wants to merge 1 commit into
Open
Conversation
…channel during shutdown causes a panic in Dataproxy Go SDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12199
Motivation
In the Dataproxy Go SDK, sending on the already-closed sendFailedBatches, retryBatches, or responseBatches channels during shutdown can raise a "send on closed channel" panic and crash the process.
Modifications
Introduced a
safeSendhelper that recovers from the closed-channel panic when sending on these channels, and marks the batch as done to release its resources when the send fails.Verifying this change
(Please pick either of the following options)
This change is a trivial rework/code cleanup without any test coverage.
This change is already covered by existing tests, such as:
(please describe tests)
This change added tests and can be verified as follows:
(example:)
Documentation