Repository navigation
Conversation
Sending, editing and deleting a message each read the group's whole messages file from S3, change it and write the file back, with no lock. Two at once both read the same old copy, so the later write dropped the other's change: two people sending at the same moment lost a message, and an edit or delete during a send lost the edit or the new message. They now take one lock per group, the same pattern as the shared-files metadata lock. Reads don't wait, and other groups don't wait on each other. The lock only works within one server. Several servers writing the same file would need S3's conditional writes instead. Tests run two sends, an edit and a send, and a delete and a send at once against an S3 stub that holds each read until the other one has started.
The storage notes said every send rewrites the file with no lock, and Known issues listed two sends at once losing one. The note now says sending, editing and deleting take one lock per group, within one server only. The testing list names GroupChatServiceTest, and the known issue is gone.
This was referenced Nov 26, 2026
svaka2000
added a commit
to svaka2000/Spring-JJ
that referenced
this pull request
Nov 26, 2026
The group chat fixes (Open-Coding-Society#296 to Open-Coding-Society#299) each add a line after the chat regression tests, so the reactions line goes above it and the two change different places.
Contributor
Author
|
Combined into #314 with the same commits. |
This file contains hidden or 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
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.
Two messages sent to the same group chat at the same moment are both saved now. Before, one of them could be gone after a reload.
<group name>/messages-images/messages.jsonl). Sending, editing and deleting a message each read that whole file, change it and upload it again, with no lock.messageLockstoGroupChatService, one lock per group, the same wayfileMetaLocksalready locksshared-files-meta.json.addMessage,editMessageanddeleteMessageeach hold their group's lock while they read, change and upload, so the second one reads the file after the first one has uploaded it.Other notes:
GroupChatServiceTestwith three cases: two sends at once, an edit during a send, and a delete during a send. On master'sGroupChatServiceall three fail, and with the lock they pass.docs/group-chat-architecture.mdI updated the storage note, addedGroupChatServiceTestto the testing list and took "Two sends at once can lose one" out of the known issues.ImportPersonPasswordTest, which needs a local.env, andPersonCapstoneApprovalRouteTest, which fails the same way on master b94d9f3 (its Spring context doesn't load).How to try it:
./mvnw test -Dtest=GroupChatServiceTest.git checkout master -- src/main/java/com/open/spring/mvc/groups/GroupChatService.javaand run the test again. All three fail.git checkout HEAD -- src/main/java/com/open/spring/mvc/groups/GroupChatService.javaputs the fix back.