fix: Fix deadlock in BigQuery destination if error occurs during write#5550
Merged
kodiakhq[bot] merged 3 commits intomainfrom Dec 13, 2022
Merged
fix: Fix deadlock in BigQuery destination if error occurs during write#5550kodiakhq[bot] merged 3 commits intomainfrom
kodiakhq[bot] merged 3 commits intomainfrom
Conversation
candiduslynx
suggested changes
Dec 12, 2022
candiduslynx
approved these changes
Dec 12, 2022
kodiakhq bot
pushed a commit
that referenced
this pull request
Dec 13, 2022
(Similar to: #5550) If a worker returns an error, it will no longer be consuming from its `writeChan`, and in this case we should exit the loop early to avoid deadlock.
kodiakhq bot
pushed a commit
that referenced
this pull request
Dec 13, 2022
🤖 I have created a release *beep* *boop* --- ## [1.1.2](plugins-destination-bigquery-v1.1.1...plugins-destination-bigquery-v1.1.2) (2022-12-13) ### Bug Fixes * BigQuery destination: wait for table migrations to complete ([#5544](#5544)) ([712ee39](712ee39)) * **deps:** Update module github.com/cloudquery/plugin-sdk to v1.12.0 ([#5539](#5539)) ([fb71293](fb71293)) * Fix deadlock in BigQuery destination if error occurs during write ([#5550](#5550)) ([e087095](e087095)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.
This fixes a deadlock that occurs if the BigQuery destination encounters an error that causes one of the writers to fail. Previously, the loop would have continued to try and send items to the channel, but these would not get processed. We now check that
gctxis not done, and exit the loop either whengctxis done (so a worker error occurred) orr, ok := <-reshasokas false, which means thereschannel was closed.This issue might also happen in some other destinations, I will take a look there shortly.