Skip to content

fix: Copy office sessions in the memory store - #5168

Open
taratatach wants to merge 1 commit into
masterfrom
fix/office-memory-store-sessions
Open

taratatach wants to merge 1 commit into
masterfrom
fix/office-memory-store-sessions

Conversation

@taratatach

Copy link
Copy Markdown
Contributor

The memory store of the OnlyOffice sessions kept the session it was
given, and GetDoc returned a pointer to the stored one: a caller
changing a session it had read changed it in the store, outside the
lock, and the MD5Sum slice stayed shared with the caller that added
the session. The redis store has no such sharing, as it reads and
writes JSON.

ConflictDetector.Clone makes a deep copy of a session. The memory
store clones a session when it stores it (AddDoc, UpdateDoc) and
when it returns it (GetDoc), so that it behaves like the redis
store. No caller changes a session it has read, so the behavior is
unchanged today.

Extracted from #5135.

  The memory store of the OnlyOffice sessions kept the session it was
  given, and `GetDoc` returned a pointer to the stored one: a caller
  changing a session it had read changed it in the store, outside the
  lock, and the `MD5Sum` slice stayed shared with the caller that added
  the session. The redis store has no such sharing, as it reads and
  writes JSON.

  `ConflictDetector.Clone` makes a deep copy of a session. The memory
  store clones a session when it stores it (`AddDoc`, `UpdateDoc`) and
  when it returns it (`GetDoc`), so that it behaves like the redis
  store. No caller changed a session it had read, so the behavior is
  unchanged today.

Co-Authored-By: AI
@taratatach
taratatach requested a review from shepilov as a code owner November 4, 2026 13:22
@taratatach taratatach self-assigned this Nov 4, 2026

This branch has not been deployed

No deployments
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.

1 participant