-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
chore(session) do not read body by default and only on certain HTTP methods #10333
Conversation
635d7c5
to
5d706a3
Compare
Aapo, is there a way to fix the performance problem without a breaking change? I'm all for fixing performance issues but I don't agree that this warrants a breaking change in Kong. Sessions library changes in 3.2 have enough breaking changes, we should not pile on that and instead try to limit them as much as possible. |
If you are looking for a non-breaking compromise, you could always try to check the |
As explained it is not only a performance fix, it also makes |
Just wondering whether it is too magical. |
The knob is there, aka set |
That's simplifying the breaking change problem a bit. If the default value before this patch is captured in decK, KIC, etc, then the effectiveness of this "bug-fix" is questionable as well since fixing the bug actually requires more work than upgrading the gateway. Are you more open to an alternate where we introduce a net new schema field that toggles the behavior of reading bodies or not? |
As said, there is already an option, just actively set |
5d706a3
to
d3ef73a
Compare
d3ef73a
to
c355d3d
Compare
c355d3d
to
b011951
Compare
3553f68
to
305dfdd
Compare
CHANGELOG.md
Outdated
that changes behavior of `logout_post_arg` in a way that it is not anymore considered if the | ||
`read_bodies` is not explicitly set to `true`. This is to avoid session plugin from reading | ||
request bodies by default on e.g. `POST` request for logout detection. | ||
[#10333](https://github.com/Kong/kong/pull/10333) |
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.
Can we move this up into the "Breaking changes" section?
I'm adding the 3.4 milestones to this patch. It seems awfully close and is a worthwhile performance change. Recommend changing the commit type to 'perf'. |
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 have tried to understand the pull request description and the CHANGELOG entry, but I found both very difficult to follow. It seems that there is consensus that the implementation makes sense, but maybe the verbiage can be improved. Happy to jump onto a Zoom to help with this.
I'm removing this from the milestone, we are too close to the GA date and have no people available to review/approve this in the meantime. |
@hbagdi We discussed whether we should really treat this as a breaking change in the PR queue review meeting earlier and these is some consensus that it is unlikely that someone relies on the current undocumented behavior. Thus, merging this PR should be fine, even if we document it as breaking change in the change log. What do you think? |
@bungle this seems to not made any progress. Do you still think this should be targeted to 3.5? |
3908a02
to
1b217f9
Compare
1b217f9
to
1360960
Compare
8b0f20c
to
05c8264
Compare
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.
To summarize this patch:
Currently we're reading the body for every request as logout_post_arg
is set to a non-null default. This forces us to look into every request body by default to detect if a logout is requested.
Reading bodies can become expensive, especially when requests with large payloads are sent. To resolve this issue there are a couple of options.
- Explicitly disable the logout functionality.
This affects a rather large group of people and doesn't really solve the issue at hand. When enabling this flag, you'd still have to set logout_post_arg
to null to avoid body reads alltogether.
- Disable body reads by default
This will also affect some people but the surface is smaller in comparison to (1). To get this functionality back, a user can re-enable this flag.
- Change the default of
logout_post_arg
This is technically speaking the most straightforward fix. Changing defaults will affect other products though and should be avoided if possible (@hbagdi agrees here)
This leaves us with (2) as it has the lowest impact and achieves what this patch tries to solve.
What I'm not happy with is the name of the config flag as it doesn't reflect the scope this parameter is used in. My proposal is
read_body_for_logout
(move from bodies to body, define the scope - for logout)
…ethods On comment: #7418 (comment) @PidgeyBE mentioned that session plugin reads bodies by on every HTTP request that is not an GET request. Because it is quite common to use bodies to send large files, reading body makes features like route.request_buffering=off, not working. Thus, a new configuration option `read_body_for_logout` was added with a default value of `false`. The bodies are only read when this is configured as `true`. This is a **breaking** change that the plugin does not anymore read body to detect logout if the `read_body_for_logout` is not explicitly set to `true`, On the other hand it is a way more common to read session than it is to log out session, thus it should be better default for future of us. Signed-off-by: Aapo Talvensaari <[email protected]>
05c8264
to
71ff1cb
Compare
Summary
On comment: #7418 (comment) @PidgeyBE mentioned that session plugin reads bodies by on every HTTP request that is not an GET request.
Because it is quite common to use bodies to send large files, reading body makes features like route.request_buffering=off, not working. Thus, the default value for
logout_post_arg
in session plugin was removed. The bodies are only read when this is configured. This might change behaviour on scripts that create session plugin and which also think that logout by body argument works as before. On the other hand it is a way more common to read session than it is to log out session, thus it should be better value for future of us.KAG-634