-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
Client
BigQuery/Storage
Environment
Any
Go Environment
Any
Code
package main
func main() {
/* initialization skipped */
// this repro uses context.WithCancel(), but the same happens on context.WithTimeout() and context.DeadlineExceeded
ctx, cancel := context.WithCancel(context.Background())
go func() {
// wait to ManagedStream.lockingAppend()
time.Sleep(100 * time.Millisecond)
cancel()
}()
_, err := stream.AppendRows(ctx, bytes) // context.Canceled is returned: expected
_, err = stream.AppendRows(context.Background(), bytes) // context.Canceled is returned: unexpected
}
This problem is race condition, so please add time.Sleep(1 * time.Second)
to https://github.com/googleapis/google-cloud-go/blob/main/bigquery/storage/managedwriter/managed_stream.go#L266
Expected behavior
ManagedStream does not hold context error.
Actual behavior
ManagedStream holds context error.
Screenshots
Additional context
Metadata
Metadata
Assignees
Labels
api: bigqueryIssues related to the BigQuery API.Issues related to the BigQuery API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.