Skip to content

fix(session): Log critical conditions where sessions might be lost - #40878

Draft
ChristophWurst wants to merge 1 commit into
masterfrom
fix/session/log-likely-lost-session-conditions
Draft

fix(session): Log critical conditions where sessions might be lost#40878
ChristophWurst wants to merge 1 commit into
masterfrom
fix/session/log-likely-lost-session-conditions

Conversation

@ChristophWurst

@ChristophWurstChristophWurst commented Oct 11, 2023

Copy link
Copy Markdown
Member

Summary

  • Regenerating session when cookies can't be sent -> lost
  • Regenerating session ID and deleting old data -> possible loss

Currently, session_regenerate_id does not handle an unstable network well, e.g. Mobile and WiFi network. Therefore, you may experience a lost session by calling session_regenerate_id.

https://www.php.net/manual/en/function.session-regenerate-id.php

Inspiration taken from https://github.com/symfony/symfony/blob/732ef5761c6576102983c99aab4a38679adce8d2/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php#L207-L229 too.

Checklist

@ChristophWurst

Copy link
Copy Markdown
MemberAuthor

/backport to stable27

@ChristophWurst
ChristophWurstforce-pushed the fix/session/log-likely-lost-session-conditions branch from 736a5f9 to 37367ecCompareOctober 11, 2023 17:57
Comment threadlib/private/Session/Internal.php Outdated
@ChristophWurst
ChristophWurstforce-pushed the fix/session/log-likely-lost-session-conditions branch from 37367ec to 44196bbCompareOctober 12, 2023 09:48
@blizzz

Copy link
Copy Markdown
Member

CI having opinions

* Regenerating session when cookies can't be sent -> lost
* Regenerating session ID and deleting old data -> possible loss
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
@ChristophWurst
ChristophWurstforce-pushed the fix/session/log-likely-lost-session-conditions branch from 44196bb to 95a14f2CompareOctober 12, 2023 12:11
'deleteOldSession' => $deleteOldSession,
]);
} elseif ($deleteOldSession) {
logger('core')->warning('Calling session_regenerate_id with delete_old_session=true can lead to lost sessions');

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

should be lowered to debug. this is called a lot

@ChristophWurst
ChristophWurst marked this pull request as draft October 13, 2023 12:03
@solracsfsolracsf added this to the Nextcloud 28 milestone Oct 27, 2023
@skjnldsvskjnldsv mentioned this pull request Nov 1, 2023
@blizzzblizzz mentioned this pull request Nov 6, 2023
@ChristophWurstChristophWurst added 1. to develop Accepted and waiting to be taken care of and removed 3. to review Waiting for reviews labels Nov 7, 2023
@ChristophWurstChristophWurst removed this from the Nextcloud 28 milestone Nov 7, 2023
@solracsfsolracsf added this to the Nextcloud 28 milestone Nov 21, 2023
@blizzzblizzz mentioned this pull request Nov 22, 2023
5 tasks
@ChristophWurstChristophWurst removed this from the Nextcloud 28 milestone Nov 22, 2023
@blizzzblizzz added this to the Nextcloud 29 milestone Nov 23, 2023
@skjnldsvskjnldsv added 2. developing Work in progress and removed 1. to develop Accepted and waiting to be taken care of labels Feb 21, 2024
This was referenced Mar 12, 2024
@AltahrimAltahrim mentioned this pull request Mar 20, 2024
@blizzzblizzz modified the milestones: Nextcloud 31, Nextcloud 32Jan 29, 2025
@blizzzblizzz modified the milestones: Nextcloud 33, Nextcloud 34Feb 16, 2026
@susnuxsusnux removed this from the Nextcloud 34.0.1 milestone Jun 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@ChristophWurst@blizzz@nickvergessen@juliusknorr@joshtrichards@susnux@solracsf@skjnldsv@nextcloud-bot