Repository navigation
fix: [stable-8.0.10][OCISDEV-1675] fix a nil pointer panic in the sharecache Remove - #814
Merged
Merged
Conversation
…recache Remove sharecache.Cache.Remove read us.UserShares[ssid].IDs with no nil check. When the user had no entry for the space of the share, Remove panicked. A share ID without a delimiter caused the same panic. The panic occurred in an errgroup goroutine and stopped the process. Remove now skips the delete when the space entry is absent. It still persists the cache, so a stale cache gets an etag conflict, a resync and a retry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
PurgeSpace stored &Shares{} with a nil Shares map. A later Add to the
same space panicked with "assignment to entry in nil map". PurgeSpace
now stores an empty map.
Remove discarded the ok value of spaces.Spaces.Load and checked the ok
value of Providers.Load again. Remove now checks the correct value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2403905
added a commit
to owncloud/ocis
that referenced
this pull request
Nov 13, 2026
… providercache Bump reva to the head of owncloud/reva#814. The new reva commit fixes a nil map in providercache.Cache.PurgeSpace and a wrong ok check in providercache.Cache.Remove. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LukasHirt
approved these changes
Nov 13, 2026
kobergj
approved these changes
Nov 13, 2026
2403905
added a commit
to owncloud/ocis
that referenced
this pull request
Nov 13, 2026
…s before it serves Bump reva to the head of owncloud/reva#814. The new reva commit lets Stop and GracefulStop of pkg/rgrpc work before the grpc server exists. Before, a SIGTERM during a slow service start crashed the sharing service with a nil pointer panic. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2403905
added a commit
to owncloud/ocis
that referenced
this pull request
Nov 13, 2026
…ncloud/reva#814 owncloud/reva#814 is merged as d74730112. Point reva to that commit. The merge does not contain the rgrpc stop-before-start fix. That fix is in owncloud/reva#815. Thus this commit also removes the vendored rgrpc change and its changelog entry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Description
sharecache.Cache.Removeinpkg/share/manager/jsoncs3/sharecache/sharecache.goreadsus.UserShares[ssid].IDswith no nil check. When the user has no entry for the space of the share, the entry is nil andRemovepanics. A share ID without a:delimiter causes the same panic, because its space key is":".The panic occurs in an errgroup goroutine in
pkg/share/manager/jsoncs3/jsoncs3.go(removeShare). Thus the panic stops the process. All removal paths are affected, for exampleUnshareand the cleanup of orphaned shares.Fix
Removeskips the delete when the space entry is nil.Removestill callsPersist.Persistsends the etag of the in-memory cache. When the cache is stale, the upload gets a conflict. ThenRetryPersistsyncs again and retries the delete. Thus a share that another node added is removed correctly.Related fixes in
pkg/share/manager/jsoncs3/providercache/providercache.goPurgeSpacestored&Shares{}with a nilSharesmap. A laterAddto the same space panicked with "assignment to entry in nil map".PurgeSpacenow stores an empty map.Removediscarded theokvalue ofspaces.Spaces.Loadand checked theokvalue ofProviders.Loadagain. Thus the guard never fired.Removenow checks the correct value. No public API path makes the space absent at this point, so this change has no test. It makes the guard work as intended.This is a minimal fix for the
stable-8.0.10-fixhotfix branch. The larger rework forstable-8.0is in #813.Tests
pkg/share/manager/jsoncs3/sharecache/sharecache_test.gohas 3 new tests:Adda share inspace-a, thenRemovea share inspace-b.Removea share ID with no delimiter.space-b. The local cache, which does not knowspace-b, removes it. The test checks that the remote file does not contain the share after this.pkg/share/manager/jsoncs3/providercache/providercache_test.gohas 1 new test:PurgeSpace, thenAddto the same space.Without the fix, all 4 tests panic. With the fix, all
pkg/share/manager/jsoncs3/...packages pass with-race.Note
The fix for the panic when a grpc server stops before it serves was pushed to this branch after the merge. It is not part of this pull request. It is in #815.
Related
🤖 Generated with Claude Code