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

importccl: Correctly handle cancelled context when importing #43789

Merged
merged 1 commit into from
Jan 7, 2020

Conversation

miretskiy
Copy link
Contributor

When calling sendRequest with the cancelled context, ensure
that we return appropriate error to the caller.

Release note (bug fix): handle cancelled context in sendRequest

Fixes #43783

@miretskiy miretskiy requested a review from dt January 7, 2020 19:36
@cockroach-teamcity
Copy link
Member

This change is Reviewable

When calling sendRequest with the cancelled context, ensure
that we return appropriate error to the caller.

Release note (bug fix): handle cancelled context in sendRequest
@miretskiy
Copy link
Contributor Author

bors r+

craig bot pushed a commit that referenced this pull request Jan 7, 2020
43789: importccl: Correctly handle cancelled context when importing r=miretskiy a=miretskiy

When calling sendRequest with the cancelled context, ensure
that we return appropriate error to the caller.

Release note (bug fix): handle cancelled context in sendRequest

Fixes #43783 

Co-authored-by: Yevgeniy Miretskiy <yevgeniy@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Jan 7, 2020

Build succeeded

@craig craig bot merged commit 0986b76 into cockroachdb:master Jan 7, 2020
@miretskiy miretskiy deleted the nilref branch April 27, 2020 14:22
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Jul 10, 2020
This commit updates the Retry utility to always guarantee at least a
single iteration of the retry loop. This fixes a previously-buggy
pattern that we have throughout the codebase where we would assume that
a retry loop would be executed at least once. With this false
understanding, we would try to return the error found in the last
iteration of the retry loop. This could cause us to return no error at
all if the loop never ran, which would trick upper levels into thinking
the retry loop had succeeded.

One instance of this bug was fixed in cockroachdb#43789.

Here are five other instances of the pattern that I believe are currently
susceptible to the bug:
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580

And a sixth was almost introduced in cockroachdb#51227.
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Jul 10, 2020
This commit updates the Retry utility to always guarantee at least a
single iteration of the retry loop. This fixes a previously-buggy
pattern that we have throughout the codebase where we would assume that
a retry loop would be executed at least once. With this false
understanding, we would try to return the error found in the last
iteration of the retry loop. This could cause us to return no error at
all if the loop never ran, which would trick upper levels into thinking
the retry loop had succeeded.

One instance of this bug was fixed in cockroachdb#43789.

Here are five other instances of the pattern that I believe are currently
susceptible to the bug:
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580

And a sixth was almost introduced in cockroachdb#51227.
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Jul 10, 2020
This commit updates the Retry utility to always guarantee at least a
single iteration of the retry loop. This fixes a previously-buggy
pattern that we have throughout the codebase where we would assume that
a retry loop would be executed at least once. With this false
understanding, we would try to return the error found in the last
iteration of the retry loop. This could cause us to return no error at
all if the loop never ran, which would trick upper levels into thinking
the retry loop had succeeded.

One instance of this bug was fixed in cockroachdb#43789.

Here are five other instances of the pattern that I believe are currently
susceptible to the bug:
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580

And a sixth was almost introduced in cockroachdb#51227.
nvanbenschoten added a commit to nvanbenschoten/cockroach that referenced this pull request Jul 10, 2020
This commit updates the Retry utility to always guarantee at least a
single iteration of the retry loop. This fixes a previously-buggy
pattern that we have throughout the codebase where we would assume that
a retry loop would be executed at least once. With this false
understanding, we would try to return the error found in the last
iteration of the retry loop. This could cause us to return no error at
all if the loop never ran, which would trick upper levels into thinking
the retry loop had succeeded.

One instance of this bug was fixed in cockroachdb#43789.

Here are five other instances of the pattern that I believe are currently
susceptible to the bug:
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580

And a sixth was almost introduced in cockroachdb#51227.
craig bot pushed a commit that referenced this pull request Jul 10, 2020
51310: util/retry: always run at least one iteration r=nvanbenschoten a=nvanbenschoten

This commit updates the Retry utility to always guarantee at least a single iteration of the retry loop. This fixes a previously-buggy pattern that we have throughout the codebase where we would assume that a retry loop would be executed at least once. With this false understanding, we would try to return the error found in the last iteration of the retry loop. This could cause us to return no error at all if the loop never ran, which would trick upper levels into thinking the retry loop had succeeded.

One instance of this bug was fixed in #43789.

Here are five other instances of the pattern that I believe are currently susceptible to the bug:
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/changefeedccl/changefeed_stmt.go#L568
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/ccl/workloadccl/fixture.go#L136
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/kv/kvserver/replica_command.go#L529
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sql/schema_changer.go#L1701
- https://github.com/cockroachdb/cockroach/blob/d0c79625eda85d3aa38afad5b0254d419a9bc4cd/pkg/sqlmigrations/migrations.go#L580

And a sixth was almost introduced in #51227.

Co-authored-by: Nathan VanBenschoten <nvanbenschoten@gmail.com>
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.

backup: panic: runtime error: invalid memory address or nil pointer dereference
3 participants