Skip to content

014 - Proposal to refactor frontend handler and centralize session context#88

Open
hrishabhg wants to merge 1 commit into
kroxylicious:mainfrom
hrishabhg:014-frontend-handler-refactoring-and-centralised-session-context
Open

014 - Proposal to refactor frontend handler and centralize session context#88
hrishabhg wants to merge 1 commit into
kroxylicious:mainfrom
hrishabhg:014-frontend-handler-refactoring-and-centralised-session-context

Conversation

@hrishabhg
Copy link
Copy Markdown

Refactor frontend handler architecture to improve separation of concerns, introduce a centralized session context, fix HAProxy message memory leak, and simplify the state machine by eliminating unnecessary states.

Refactor frontend handler architecture to improve separation of concerns, introduce a centralized session context, fix HAProxy message memory leak, and simplify the state machine by eliminating unnecessary states.

Signed-off-by: Hrishabh Gupta <hgupta@confluent.io>
@hrishabhg hrishabhg requested a review from a team as a code owner January 27, 2026 04:46
@hrishabhg hrishabhg marked this pull request as draft January 27, 2026 04:47
@hrishabhg hrishabhg marked this pull request as ready for review January 27, 2026 04:47
@hrishabhg hrishabhg changed the title Proposal to refactor frontend handler and centralize session context 014 - Proposal to refactor frontend handler and centralize session context Jan 27, 2026
Copy link
Copy Markdown
Member

@tombentley tombentley left a comment

Choose a reason for hiding this comment

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

This seems mostly reasonable. Thanks.

As a more general point, please don't feel the need to write a proposal for a refactoring which doesn't touch public APIs (which is the case here). A proposal can serve as a place to discuss a larger change without actually having to implement it in its entirety so you can open a PR for it.

I've also been thinking about a few other changes which would function as either clean up of accumulated tech debt (which we should do anyway) or enablers for routing-like functionality:

  • Currently we initialize the backend pipeline in the frontend handler. That seems ripe for moving to the backend handler itself. I hope to open a PR for this next week.
  • I think we should be able to factor out some kind of abstraction for tracking reasons and managing the autoRead flag which we use for backpressure. I hope to open a PR for this next week.
  • I don't think the PCSM can really survive in its current form if we want to support routing. It seems to me there's a state machine associated with the frontend (tracking the building up of your ClientSession), and one associated with a backend. A router could only forward (most) requests to a backend once we have TCP, TLS?, SASL?. At that point the Route is in the FORWARDING state, and requests can pass down the pipeline associated with that Route. Does this fit whatever thoughts you might have had about routing?

Comment on lines +18 to +20
### HAProxy message memory leak

`HAProxyMessage` implements Netty's `ReferenceCounted` interface but is never released. The message is intercepted in `HAProxyMessageHandler`, passed to the state machine, stored in state records, but never has `release()` called. This causes a memory leak.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like low-hanging fruit which doesn't depend on the rest. We should just fix it. Would you be willing to open a PR for this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I will take that up soon with the HAProxyMessage fix.

k-wall added a commit to k-wall/design that referenced this pull request Apr 9, 2026
This introduces a proposal index (README.md) for the proposals directory
to solve the problem of colliding proposal numbers.

Currently, multiple open PRs have chosen proposal numbers that conflict
with already-merged proposals. This creates confusion and makes it
difficult to maintain stable identifiers for proposals - which is
essential for productive discussion on the mailing list.

The new process:
1. Authors create proposals with temporary filenames (nnn-*)
2. A separate PR to this README allocates the next sequential number
3. Authors rename their proposal once the number is allocated
4. The index is updated again when proposals are accepted

This ensures:
- Proposal numbers are allocated chronologically
- No number collisions occur
- Each proposal gets a stable identifier before mailing list discussion
- Clear visibility of open vs. accepted proposals

Current collisions resolved by this index:
- PR kroxylicious#70, kroxylicious#82, kroxylicious#83, kroxylicious#88, kroxylicious#89 all have numbers conflicting with accepted
  proposals and have been allocated new sequential numbers (016-024)

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
k-wall added a commit to k-wall/design that referenced this pull request Apr 9, 2026
This introduces a proposal index (README.md) for the proposals directory
to solve the problem of colliding proposal numbers.

Currently, multiple open PRs have chosen proposal numbers that conflict
with already-merged proposals. This creates confusion and makes it
difficult to maintain stable identifiers for proposals - which is
essential for productive discussion on the mailing list.

The new process:
1. Authors create proposals with temporary filenames (nnn-*)
2. A separate PR to this README allocates the next sequential number
3. Authors rename their proposal once the number is allocated
4. The index is updated again when proposals are accepted

This ensures:
- Proposal numbers are allocated chronologically
- No number collisions occur
- Each proposal gets a stable identifier before mailing list discussion
- Clear visibility of open vs. accepted proposals

Current collisions resolved by this index:
- PR kroxylicious#70, kroxylicious#82, kroxylicious#83, kroxylicious#88, kroxylicious#89 all have numbers conflicting with accepted
  proposals and have been allocated new sequential numbers (016-024)

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Keith Wall <kwall@apache.org>
k-wall added a commit to k-wall/design that referenced this pull request Apr 9, 2026
This introduces a proposal index (README.md) for the proposals directory
to solve the problem of colliding proposal numbers.

Currently, multiple open PRs have chosen proposal numbers that conflict
with already-merged proposals. This creates confusion and makes it
difficult to maintain stable identifiers for proposals - which is
essential for productive discussion on the mailing list.

The new process:
1. Authors create proposals with temporary filenames (nnn-*)
2. A separate PR to this README allocates the next sequential number
3. Authors rename their proposal once the number is allocated
4. The index is updated again when proposals are accepted

This ensures:
- Proposal numbers are allocated chronologically
- No number collisions occur
- Each proposal gets a stable identifier before mailing list discussion
- Clear visibility of open vs. accepted proposals

Current collisions resolved by this index:
- PR kroxylicious#70, kroxylicious#82, kroxylicious#83, kroxylicious#88, kroxylicious#89 all have numbers conflicting with accepted
  proposals and have been allocated new sequential numbers (016-024)

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Keith Wall <kwall@apache.org>
k-wall added a commit to k-wall/design that referenced this pull request Apr 24, 2026
This introduces a proposal index (README.md) for the proposals directory
to solve the problem of colliding proposal numbers.

Currently, multiple open PRs have chosen proposal numbers that conflict
with already-merged proposals. This creates confusion and makes it
difficult to maintain stable identifiers for proposals - which is
essential for productive discussion on the mailing list.

The new process:
1. Authors create proposals with temporary filenames (nnn-*)
2. A separate PR to this README allocates the next sequential number
3. Authors rename their proposal once the number is allocated
4. The index is updated again when proposals are accepted

This ensures:
- Proposal numbers are allocated chronologically
- No number collisions occur
- Each proposal gets a stable identifier before mailing list discussion
- Clear visibility of open vs. accepted proposals

Current collisions resolved by this index:
- PR kroxylicious#70, kroxylicious#82, kroxylicious#83, kroxylicious#88, kroxylicious#89 all have numbers conflicting with accepted
  proposals and have been allocated new sequential numbers (016-024)

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Keith Wall <kwall@apache.org>
k-wall added a commit to k-wall/design that referenced this pull request Apr 28, 2026
This change simplifies the proposal numbering system by using PR numbers
as proposal identifiers, eliminating number collisions and removing the
need for a separate allocation process.

Changes:
- Simplified proposals/README.md to focus on author workflow
  - Removed index tables (directory listing serves as the index)
  - Streamlined instructions for creating and renaming proposals
- Updated proposal template with workflow instructions
  - Require PR number in title format: # <PR#> - <Title>
  - Moved workflow instructions into comment block
- Added GitHub workflow to automatically check proposal numbering
  - Validates both filename and title format
  - Updates PR description when proposal files don't match PR number
  - Provides exact commands to fix naming issues
  - Removes warning once corrected
  - Handles both added and renamed files
  - Runs on all PRs (ready for mandatory status check)
- Added notification script for existing open PRs
  - After merge, run notify-open-prs.sh to ask authors to rebase
  - Workflow will automatically guide them through renaming
  - Updated with all current open proposal PRs (kroxylicious#70, kroxylicious#82, kroxylicious#83, kroxylicious#85,
    kroxylicious#88, kroxylicious#93, kroxylicious#94, kroxylicious#96, kroxylicious#98, kroxylicious#99, kroxylicious#100, kroxylicious#101, kroxylicious#103)

Proposals 001-019 retain their original numbers.

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Keith Wall <kwall@apache.org>
k-wall added a commit that referenced this pull request Apr 28, 2026
This change simplifies the proposal numbering system by using PR numbers
as proposal identifiers, eliminating number collisions and removing the
need for a separate allocation process.

Changes:
- Simplified proposals/README.md to focus on author workflow
  - Removed index tables (directory listing serves as the index)
  - Streamlined instructions for creating and renaming proposals
- Updated proposal template with workflow instructions
  - Require PR number in title format: # <PR#> - <Title>
  - Moved workflow instructions into comment block
- Added GitHub workflow to automatically check proposal numbering
  - Validates both filename and title format
  - Updates PR description when proposal files don't match PR number
  - Provides exact commands to fix naming issues
  - Removes warning once corrected
  - Handles both added and renamed files
  - Runs on all PRs (ready for mandatory status check)
- Added notification script for existing open PRs
  - After merge, run notify-open-prs.sh to ask authors to rebase
  - Workflow will automatically guide them through renaming
  - Updated with all current open proposal PRs (#70, #82, #83, #85,
    #88, #93, #94, #96, #98, #99, #100, #101, #103)

Proposals 001-019 retain their original numbers.

Assisted-By: Claude Sonnet 4.5 <noreply@anthropic.com>

Signed-off-by: Keith Wall <kwall@apache.org>
@k-wall
Copy link
Copy Markdown
Member

k-wall commented Apr 28, 2026

Hi! We've updated the proposal numbering system to use PR numbers as proposal identifiers.

Action required: Please rebase your PR on main.

Once you rebase, you'll need to rename your proposal file and update the title:

git mv proposals/014-frontend-handler-refactoring-and-centralised-session-context.md proposals/088-handler-refactoring-and-centralised-session-context.md
# Update title: remove any old number prefix and add PR number
sed -i.bak '0,/^# /{s/^# \([0-9]\{3\}\|xxx\|nnn\|000\) - /# 88 - /; t; s/^# /# 88 - /}' proposals/088-handler-refactoring-and-centralised-session-context.md && rm proposals/088-handler-refactoring-and-centralised-session-context.md.bak
git add proposals/088-handler-refactoring-and-centralised-session-context.md
git commit -m "Rename proposal to use PR number"
git push

The GitHub workflow will automatically check your proposal file naming after you push and update this PR description if any corrections are still needed.

See proposals/README.md for the updated workflow.

@k-wall
Copy link
Copy Markdown
Member

k-wall commented Apr 28, 2026

Correction: The previous notification had an incorrect filename. Here are the correct commands:

git mv proposals/014-frontend-handler-refactoring-and-centralised-session-context.md proposals/088-frontend-handler-refactoring-and-centralised-session-context.md
# Update title: remove any old number prefix and add PR number
sed -i.bak '0,/^# /{s/^# \([0-9]\{3\}\|xxx\|nnn\|000\) - /# 88 - /; t; s/^# /# 88 - /}' proposals/088-frontend-handler-refactoring-and-centralised-session-context.md && rm proposals/088-frontend-handler-refactoring-and-centralised-session-context.md.bak
git add proposals/088-frontend-handler-refactoring-and-centralised-session-context.md
git commit -m "Rename proposal to use PR number"
git push

Sorry for the confusion!

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