-
Notifications
You must be signed in to change notification settings - Fork 536
fix(CubeProxy): disable buffering for envd streaming endpoints #647
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
Open
zyl1121
wants to merge
1
commit into
TencentCloud:master
Choose a base branch
from
zyl1121:fix/cubeproxy-envd-stream-buffering
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−2
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| proxy_buffering off; | ||
| # Streaming envd errors must pass through verbatim; intercepting them here | ||
| # would replace protocol-native error frames with nginx error pages and break | ||
| # client-side parsing. | ||
| proxy_intercept_errors off; | ||
|
|
||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade $http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
|
|
||
| proxy_send_timeout 7206s; | ||
| proxy_read_timeout 7206s; | ||
| proxy_connect_timeout 3s; | ||
| proxy_set_header Host $http_host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
|
|
||
| rewrite_by_lua_file lua/rewrite_phase.lua; | ||
|
|
||
| proxy_pass http://backend; | ||
|
|
||
| header_filter_by_lua_file lua/header_filter_phase.lua; | ||
|
|
||
| log_by_lua_file lua/log_phase.lua; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| proxy_buffering off; | ||
| # Streaming envd errors must pass through verbatim; intercepting them here | ||
| # would replace protocol-native error frames with nginx error pages and break | ||
| # client-side parsing. | ||
| proxy_intercept_errors off; | ||
|
|
||
| proxy_http_version 1.1; | ||
| proxy_set_header Upgrade $http_upgrade; | ||
| proxy_set_header Connection "upgrade"; | ||
|
|
||
| proxy_send_timeout 7206s; | ||
| proxy_read_timeout 7206s; | ||
| proxy_connect_timeout 3s; | ||
| proxy_set_header Host $http_host; | ||
| proxy_set_header X-Real-IP $remote_addr; | ||
| proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| proxy_set_header X-Forwarded-Prefix /sandbox/$ins_id/$container_port; | ||
|
|
||
| proxy_redirect ~^/(.*)$ /sandbox/$ins_id/$container_port/$1; | ||
| proxy_cookie_path / /sandbox/$ins_id/$container_port/; | ||
|
|
||
| rewrite_by_lua_file lua/path_rewrite_phase.lua; | ||
|
|
||
| proxy_pass http://backend; | ||
|
|
||
| header_filter_by_lua_file lua/header_filter_phase.lua; | ||
|
|
||
| log_by_lua_file lua/log_phase.lua; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need
SendInputhere?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on a real cluster as a follow-up, and I don't think we need a separate unbuffered
SendInputroute.SendInputitself is still a unary/input-side call, the real-time output is delivered through the already-unbufferedStart/Connectstreaming paths.In the PTY repro, with the current patch,
pty.send_stdin()returned in about 10ms and the PTY marker was streamed back in about 15ms. After removing the unbuffering change forStart/Connect, the serial PTY flow was blocked earlier:pty.create()was buffered until near the connection timeout, and the laterconnect()/send_stdin()calls failed withNotFoundException. This points to the streamingStart/Connectpath as the failure point, notSendInput.I also attached the repro script I used. After exporting the corresponding SDK environment variables for the target cluster, it can be run directly, for example:
The script I used: demo-pty.py