-
Notifications
You must be signed in to change notification settings - Fork 498
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
[WIP] [IGNORE] proxy: conrad is messing around #6283
Closed
Closed
Conversation
This file contains 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
2280 tests run: 2189 passed, 0 failed, 91 skipped (full report)Code coverage (full report)
The comment gets automatically updated with the latest test results
7fed0ba at 2024-01-23T14:09:38.196Z :recycle: |
e081cbe
to
1d94afb
Compare
37635a3
to
a10b382
Compare
4c3be75
to
7ffaa0f
Compare
7ffaa0f
to
c067cb2
Compare
conradludgate
added a commit
that referenced
this pull request
Jan 21, 2024
## Problem In #6283 I did a couple changes that weren't directly related to the goal of extracting the state machine, so I'm putting them here ## Summary of changes - move postgres vs console provider into another enum - reduce error cases for link auth - slightly refactor link flow
c067cb2
to
7fed0ba
Compare
abhigets
pushed a commit
that referenced
this pull request
Jan 24, 2024
## Problem In #6283 I did a couple changes that weren't directly related to the goal of extracting the state machine, so I'm putting them here ## Summary of changes - move postgres vs console provider into another enum - reduce error cases for link auth - slightly refactor link flow
conradludgate
added a commit
that referenced
this pull request
Jan 29, 2024
## Problem Taking my ideas from #6283 and doing a bit less radical changes. smaller commits. Proxy flow was quite deeply nested, which makes adding more interesting error handling quite tricky. ## Summary of changes I recommend reviewing commit by commit. 1. move handshake logic into a separate file 2. move passthrough logic into a separate file 3. no longer accept a closure in CancelMap session logic 4. Remove connect_to_db, copy logic into handle_client 5. flatten auth_and_wake_compute in authenticate 6. record info for link auth
conradludgate
added a commit
that referenced
this pull request
Feb 9, 2024
## Problem Taking my ideas from #6283 and doing a bit less radical changes. smaller commits. We currently don't report error classifications in proxy as the current error handling made it hard to do so. ## Summary of changes 1. Add a `ReportableError` trait that all errors will implement. This provides the error classification functionality. 2. Handle Client requests a strongly typed error * this error is a `ReportableError` and is logged appropriately 3. The handle client error only has a few possible error types, to account for the fact that at this point errors should be returned to the user.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Error handling has always been a pain in the ass (#5599). I think much of that is due to errors being so deep in the stack.
Additionally, the full handle_client future is 8KiB, which seems wasteful once we get to proxy_pass.
This has been an idea I wanted to do for ages now, this weekend I got the courage and motivation to try it out.
Summary of changes
Refactor proxy to use a state machine paradigm. Proxy processes requests in a very linear way, so these state machines are straightforward.
The main benefit here is that each stage in the state machine is only 1 step away from the error handling for that session. There are no complicated error chains to worry about. All errors are now
ReportableError
s. These have a direct blame associated with them (as introduced in my RequestMonitoring PR).Current state machine flows:
The core of this setup is in
state_machine.rs
with theStage
trait.Stage
essentially describesStage -> Option<Result<Stage>>
as a step in the state machine.In this setup, the largest future (
NeedsCompute
) is 904 bytes, whereasProxyPass
, the final stage, is only 224 bytes. This means that 10000 active database connections go down from 85.4MiB to 2.13MiB (this is not counting additional allocations each connection might hold)Checklist before requesting a review
Checklist before merging