Repository navigation
Conversation
…erves pkg/rgrpc created the grpc server only at the end of registerServices, after all service constructors returned. The sharing service builds the jsoncs3 share manager there, and that constructor retries the NATS connection for up to 15 minutes. A SIGTERM during this time made Stop and GracefulStop call the nil *grpc.Server and panic. This happened on school-91003 on 2026-11-12. - registerServices returns the grpc server and the services. It does not store them. - Start stores them under a mutex. When a stop came first, Start closes the services and returns nil. It does not serve. - Stop and GracefulStop mark the server as stopped. They call the grpc server only when it exists. - cleanupServices closes each service one time only. - Start treats grpc.ErrServerStopped as a normal end. The mutex also removes the data race on s.s between Start and Stop. 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. |
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
On school-91003, two
sharingpods crashed on 2026-11-12. Each crash was a nil pointer panic ingrpc.(*Server).stop(0x0, 0x1)during the shutdown:Cause
pkg/rgrpc/rgrpc.gocreates the*grpc.Serveronly at the end ofregisterServices, after all service constructors return.StartcallsregisterServices.NewDefaultinpkg/share/manager/jsoncs3/jsoncs3.goconnects to NATS.Natsinpkg/events/stream/nats.goretries this connection for up to 15 minutes.StoporGracefulStop. These functions call the nils.sand panic.Startwritess.sin one goroutine, andStopreads it in another goroutine. No synchronization protects it, so this is also a data race.Fix
All changes are in
pkg/rgrpc/rgrpc.go.registerServicesreturns the grpc server and the services. It does not store them.Startstores them under a mutex. When a stop came first,Startcloses the services and returns nil. It does not serve.StopandGracefulStopmark the server as stopped. They call the grpc server only when it exists.cleanupServicescloses each service one time only, also whenStopruns afterGracefulStop.Starttreatsgrpc.ErrServerStoppedas a normal end.Servereturns this error when the stop comes afters.sis set but beforeServestarts.Service constructors still get a nil
*grpc.Server, as before.s.swas nil at that point in the old code too.Tests
pkg/rgrpc/rgrpc_test.gois new. It has 6 tests:StopbeforeStart.GracefulStopbeforeStart.StartafterGracefulStop.Startmust return without serving.GracefulStopwhile a service constructor blocks. The service must be closed one time.Stopwhile a service constructor blocks. The service must be closed one time.GracefulStopafterStart.On the old
pkg/rgrpc/rgrpc.go, tests 1–5 panic with the production error, and test 6 shows a data race. With the fix, all 6 tests pass 10 times with-race.go build ./...passes.Related
stable-8.0.10-fixyet. This pull request is a cherry-pick ofa9bd5670e. Only the changelog link changed.🤖 Generated with Claude Code