Skip to content

fix(protocol): header safe for concurrent reading #1321

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

Merged
merged 1 commit into from
Apr 7, 2025

Conversation

xiaost
Copy link
Contributor

@xiaost xiaost commented Apr 3, 2025

b := []byte(key) // <--- ([]byte)(key) does not escape
utils.NormalizeHeaderKey(b, false)
return h.peek(bytesconv.B2s(b))

actually there is no need to reuse a buf for normalizing key ...

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.
  • Attach the PR updating the user documentation if the current PR requires user awareness at the usage level. User docs repo

(Optional) Translate the PR title into Chinese.

修复 Header 对于 Peek 方法不是并发安全的问题

(Optional) More detailed description for this PR(en: English/zh: Chinese).

en:
zh(optional):

(Optional) Which issue(s) this PR fixes:

(Optional) The PR that updates user documentation:

@xiaost xiaost force-pushed the fix-header-concurrency branch from 787d1dc to 64dcb4c Compare April 3, 2025 10:43
Copy link

codecov bot commented Apr 3, 2025

Codecov Report

Attention: Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

Project coverage is 72.80%. Comparing base (95440fa) to head (10a7166).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
pkg/protocol/header.go 88.88% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1321      +/-   ##
===========================================
+ Coverage    72.78%   72.80%   +0.02%     
===========================================
  Files          139      139              
  Lines        16242    16244       +2     
===========================================
+ Hits         11821    11826       +5     
+ Misses        3824     3823       -1     
+ Partials       597      595       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xiaost xiaost marked this pull request as ready for review April 3, 2025 10:53
@xiaost xiaost requested review from a team as code owners April 3, 2025 10:53
```
b := []byte(key) // <--- ([]byte)(key) does not escape
utils.NormalizeHeaderKey(b, false)
return h.peek(bytesconv.B2s(b))
```

actually there is no need to reuse a buf for normalizing key ...
@xiaost xiaost force-pushed the fix-header-concurrency branch from 64dcb4c to 10a7166 Compare April 3, 2025 18:36
@xiaost xiaost merged commit 907afa3 into develop Apr 7, 2025
28 checks passed
@xiaost xiaost deleted the fix-header-concurrency branch April 7, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants