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 bug when ServeHTTP panic #198

Merged
merged 1 commit into from
Jan 15, 2021
Merged

fix bug when ServeHTTP panic #198

merged 1 commit into from
Jan 15, 2021

Conversation

aholic
Copy link
Contributor

@aholic aholic commented Jan 14, 2021

Ⅰ. Describe what this PR does

when client close the connection in advance, reserveproxy.ServeHTTP will panic, and everything after ServeHTTP will be skipped except "defer". so the element in reqChan(function WithMaxInFlightLimit) leaks.

reproduce:

  1. send a watch curl to yurthub, and stop using ctrl+c (eg. curl '127.0.0.1:10261/apis/node.k8s.io/v1beta1/runtimeclasses?resourceVersion=1235193475&timeout=5m&timeoutSeconds=300&watch=true' -o /dev/null -v
  2. do step-1 for 250 times(depends on the config MaxRequestInFlight)
  3. send any request to yurthub, you'll get 429

this pr moves the operation of the chan into defer, to make sure it will run after ServeHTTP

Ⅱ. Does this pull request fix one issue?

Ⅲ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.

Ⅳ. Describe how to verify it

see the reproduce steps mentioned above

Ⅴ. Special notes for reviews

@CLAassistant
Copy link

CLAassistant commented Jan 14, 2021

CLA assistant check
All committers have signed the CLA.

@rambohe-ch
Copy link
Member

LGTM

@rambohe-ch rambohe-ch merged commit fa16983 into openyurtio:master Jan 15, 2021
MrGirl pushed a commit to MrGirl/openyurt that referenced this pull request Mar 29, 2022
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.

3 participants