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

Fix: body buffer too short #1090

Merged
merged 12 commits into from
Mar 19, 2021
Merged

Fix: body buffer too short #1090

merged 12 commits into from
Mar 19, 2021

Conversation

xiejiajun
Copy link

What this PR does:

  • bug fix: getty RpcServerPackageHandler decode tcp pkg failed because of the body buffer is smaller than the size marked  by header

Which issue(s) this PR fixes:

Fixes #1089

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


@AlexStocks
Copy link
Contributor

would u add an ut for ur pr?

@AlexStocks AlexStocks changed the base branch from master to 1.5 March 18, 2021 12:03
@AlexStocks AlexStocks added this to the v1.5.6-rc2 milestone Mar 18, 2021
Copy link
Member

@wenxuwan wenxuwan left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -114,7 +114,8 @@ func (p *RpcServerPackageHandler) Read(ss getty.Session, data []byte) (interface
req, length, err := (p.server.codec).Decode(data)
//resp,len, err := (*p.).DecodeResponse(buf)
if err != nil {
if err == hessian.ErrHeaderNotEnough || err == hessian.ErrBodyNotEnough {
originErr := perrors.Cause(err)
if originErr == hessian.ErrHeaderNotEnough || originErr == hessian.ErrBodyNotEnough {
Copy link
Member

Choose a reason for hiding this comment

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

How about using errors.Is() ?

Copy link
Author

Choose a reason for hiding this comment

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

Good idea.

Copy link
Author

Choose a reason for hiding this comment

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

@flycash please review

@codecov-io
Copy link

codecov-io commented Mar 19, 2021

Codecov Report

Merging #1090 (51f6d0f) into 1.5 (968650f) will decrease coverage by 0.42%.
The diff coverage is 60.42%.

❗ Current head 51f6d0f differs from pull request most recent head c6a448b. Consider uploading reports for the commit c6a448b to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              1.5    #1090      +/-   ##
==========================================
- Coverage   59.53%   59.10%   -0.43%     
==========================================
  Files         259      269      +10     
  Lines       12737    13122     +385     
==========================================
+ Hits         7583     7756     +173     
- Misses       4199     4396     +197     
- Partials      955      970      +15     
Impacted Files Coverage Δ
cluster/cluster_impl/available_cluster.go 100.00% <ø> (ø)
cluster/cluster_impl/zone_aware_cluster_invoker.go 64.28% <ø> (ø)
cluster/router/healthcheck/factory.go 66.66% <0.00%> (ø)
cluster/router/tag/router_rule.go 89.47% <ø> (+12.20%) ⬆️
common/config/environment.go 67.56% <ø> (+15.84%) ⬆️
common/extension/config_post_processor.go 0.00% <0.00%> (ø)
common/extension/conn_checker.go 0.00% <0.00%> (ø)
common/extension/metadata_service.go 0.00% <0.00%> (ø)
common/proxy/proxy_factory/default.go 13.55% <0.00%> (+0.22%) ⬆️
config/base_config.go 64.02% <ø> (ø)
... and 183 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 274718b...c6a448b. Read the comment docs.

Copy link
Contributor

@cvictory cvictory left a comment

Choose a reason for hiding this comment

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

LGTM

@AlexStocks AlexStocks merged commit ae5743a into apache:1.5 Mar 19, 2021
AlexStocks added a commit that referenced this pull request Apr 14, 2021
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.

getty RpcServerPackageHandler拆包bug
6 participants