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 unexpected EOF when compression is enabled #834

Merged
merged 3 commits into from
Oct 21, 2022
Merged

fix unexpected EOF when compression is enabled #834

merged 3 commits into from
Oct 21, 2022

Conversation

localvar
Copy link
Collaborator

when compression is enabled in a Proxy, it may fail with io.UnexpectedEOF and return HTTP 500 to the client.

@codecov-commenter
Copy link

codecov-commenter commented Oct 20, 2022

Codecov Report

Base: 77.02% // Head: 76.88% // Decreases project coverage by -0.13% ⚠️

Coverage data is based on head (a37a0d8) compared to base (7a75cc8).
Patch coverage: 56.66% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #834      +/-   ##
==========================================
- Coverage   77.02%   76.88%   -0.14%     
==========================================
  Files         103      103              
  Lines       11523    11536      +13     
==========================================
- Hits         8876     8870       -6     
- Misses       2149     2163      +14     
- Partials      498      503       +5     
Impacted Files Coverage Δ
pkg/protocols/httpprot/response.go 83.95% <ø> (ø)
pkg/filters/proxy/pool.go 79.17% <14.28%> (ø)
pkg/filters/responseadaptor/responseadaptor.go 68.69% <50.00%> (-0.68%) ⬇️
pkg/filters/requestadaptor/requestadaptor.go 75.46% <66.66%> (-1.32%) ⬇️
pkg/object/httpserver/mux.go 87.20% <75.00%> (ø)
pkg/filters/proxy/compression.go 85.00% <100.00%> (+0.38%) ⬆️
pkg/filters/proxy/wspool.go 75.18% <100.00%> (ø)
pkg/cluster/cluster.go 60.10% <0.00%> (-1.06%) ⬇️
pkg/object/mqttproxy/broker.go 74.79% <0.00%> (-1.01%) ⬇️
pkg/object/autocertmanager/autocertmanager.go 93.46% <0.00%> (-0.82%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -549,7 +549,7 @@ func (mi *muxInstance) serveHTTP(stdw http.ResponseWriter, stdr *http.Request) {
}
err := req.FetchPayload(maxBodySize)
if err == httpprot.ErrRequestEntityTooLarge {
logger.Debugf("%s: %s", mi.superSpec.Name(), err.Error())
logger.Debugf("%s: %s, you may need to increase 'clientMaxBodySize' or set it to -1", mi.superSpec.Name(), err.Error())
Copy link
Collaborator

Choose a reason for hiding this comment

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

should be logged at the level of the ERROR?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think these messages can be triggered by the client, which means an attacker can generate tons of them.
So I set them all to debug.

Copy link
Contributor

Choose a reason for hiding this comment

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

use tools like sync.Once to print it once?

Copy link
Collaborator Author

@localvar localvar Oct 20, 2022

Choose a reason for hiding this comment

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

using sync.Once means the user cannot reproduce the error.
I think a better solution is to support adjusting the lowest log level at runtime.

Copy link
Collaborator

@zhao-kun zhao-kun Oct 20, 2022

Choose a reason for hiding this comment

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

Just a little cost of the I/O, in debug level, the user hard to diagnose the problem. If users switch to output debug, they will pay more cost of I/O and disk.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we change this one to Error, we should also change some Debugs to Errors, so the I/O cost may not be minimal.

and IMHO, I think 'error' is something unexpected and we cannot handle correctly, while debug is something we know could happen.

Copy link
Collaborator

Choose a reason for hiding this comment

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

In my understanding, from the user's perspective, it's unexpected, the error was produced by the easegress instead of backend or frontend.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the users couldn't be familiar with the codes like you.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, updated.

@localvar localvar merged commit 39255e3 into easegress-io:main Oct 21, 2022
@localvar localvar deleted the fix-unexpected-eof branch October 21, 2022 06:33
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.

None yet

5 participants