Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

symbols: avoid spamming handleParseRequest on context cancelation#61732

Merged
keegancsmith merged 1 commit intomainfrom
k/handle-parse-cancel
Apr 11, 2024
Merged

symbols: avoid spamming handleParseRequest on context cancelation#61732
keegancsmith merged 1 commit intomainfrom
k/handle-parse-cancel

Conversation

@keegancsmith
Copy link
Member

Understanding how Parse works (and its callers) with respect to goroutines and channels is a sure path to the asylum. This is a short term fix around how it behaves when the context is canceled.

From what I can tell we can have a large number of parse requests go through handleParseRequest even once the context has been canceled, leading to large amounts of logging of errors which all amount to context canceled. This is a short term fix which drains the channel if we know we are just gonna fail our call to handleParseRequest.

Test Plan: go test. Didn't manual test, but the code change is minor enough that I trust it (famous last words).

Understanding how Parse works (and its callers) with respect to
goroutines and channels is a sure path to the asylum. This is a short
term fix around how it behaves when the context is canceled.

From what I can tell we can have a large number of parse requests go
through handleParseRequest even once the context has been canceled,
leading to large amounts of logging of errors which all amount to
context canceled. This is a short term fix which drains the channel if
we know we are just gonna fail our call to handleParseRequest.

Test Plan: go test. Didn't manual test, but the code change is minor
enough that I trust it (famous last words).
@keegancsmith keegancsmith requested a review from a team April 9, 2024 16:14
@cla-bot cla-bot bot added the cla-signed label Apr 9, 2024
@github-actions github-actions bot added team/product-platform team/search-platform Issues owned by the search platform team labels Apr 9, 2024
Copy link
Contributor

@jtibshirani jtibshirani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you see this as complementing https://github.com/sourcegraph/sourcegraph/pull/61719? Maybe it's not strictly needed but it's a good practice to check context cancellation?

@keegancsmith
Copy link
Member Author

Yup is a complement to it. To be honest if I could understand how all the goroutines and channels fit together properly I would do some sort of break out of the loop. Instead this essentially just avoids calling that function if we know it won't run due to context cancellation.

@keegancsmith keegancsmith merged commit a0b74fb into main Apr 11, 2024
@keegancsmith keegancsmith deleted the k/handle-parse-cancel branch April 11, 2024 07:27
sourcegraph-release-bot pushed a commit that referenced this pull request Apr 11, 2024
…1732)

Understanding how Parse works (and its callers) with respect to
goroutines and channels is a sure path to the asylum. This is a short
term fix around how it behaves when the context is canceled.

From what I can tell we can have a large number of parse requests go
through handleParseRequest even once the context has been canceled,
leading to large amounts of logging of errors which all amount to
context canceled. This is a short term fix which drains the channel if
we know we are just gonna fail our call to handleParseRequest.

Test Plan: go test. Didn't manual test, but the code change is minor
enough that I trust it (famous last words).

(cherry picked from commit a0b74fb)
jdpleiness pushed a commit that referenced this pull request Apr 12, 2024
…text cancelation (#61771)

symbols: avoid spamming handleParseRequest on context cancelation (#61732)

Understanding how Parse works (and its callers) with respect to
goroutines and channels is a sure path to the asylum. This is a short
term fix around how it behaves when the context is canceled.

From what I can tell we can have a large number of parse requests go
through handleParseRequest even once the context has been canceled,
leading to large amounts of logging of errors which all amount to
context canceled. This is a short term fix which drains the channel if
we know we are just gonna fail our call to handleParseRequest.

Test Plan: go test. Didn't manual test, but the code change is minor
enough that I trust it (famous last words).

(cherry picked from commit a0b74fb)

Co-authored-by: Keegan Carruthers-Smith <keegan.csmith@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants