fix: on awareness craah prevention and memory leak onStoreDocument#1032
Merged
janthurau merged 4 commits intoueberdosis:mainfrom Dec 9, 2025
Merged
Conversation
Contributor
|
Thank you for your PR! Could you reformat it with |
- Fix BUG ueberdosis#1: Lock memory leak - store acquired lock in locks map - Fix BUG ueberdosis#3: Awareness crash when no connections - check connections before publish Fixes ueberdosis#1027
Contributor
Author
|
I had Prettier configured differently in my local environment. Let me know if everything looks good. Otherwise, I can create a new branch and open a fresh pull request: now that Prettier is disabled locally, this shouldn't happen again. Just tell me what you prefer! |
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.
Critical Bugs in @hocuspocus/extension-redis
Description
Two critical bugs in
@hocuspocus/extension-redisv3.4.0 cause memory leaks and server crashes in production:Steps to reproduce the bug
Bug 1: Lock Memory Leak
onStoreDocument)afterStoreDocumentexecutiononStoreDocument(line 224) are never released byafterStoreDocument(line 252) becauselocks.get(lockKey)returnsundefinedRoot cause: Missing
this.locks.set(resource, { lock })after acquiring the lock inonStoreDocument.Bug 2: Awareness Update Crash (#1027)
Root cause:
onAwarenessUpdateattempts to publish to Redis even whenconnections.size === 0, causing ioredis to fail.Expected behavior
onStoreDocumentshould be stored inthis.locksmap and properly released inafterStoreDocument, preventing memory leaksEnvironment
Impact
Bug 1 (Lock Leak)
lockAttempts:1, lockReleases:0Bug 2 (Awareness Crash)
Proposed Fix