diff --git a/changelog/unreleased/fix-group-sharing-panic.md b/changelog/unreleased/fix-group-sharing-panic.md new file mode 100644 index 0000000000..5032b2362c --- /dev/null +++ b/changelog/unreleased/fix-group-sharing-panic.md @@ -0,0 +1,7 @@ +Bugfix: Fix panic when sharing with groups + +We fixed a bug which caused a panic when sharing with groups, this only happened under a heavy load. +Besides the bugfix, we also reduced the number of share auto accept log messages to avoid flooding the logs. + +https://github.com/owncloud/ocis/pull/10279 +https://github.com/owncloud/ocis/issues/10258 diff --git a/services/frontend/pkg/command/events.go b/services/frontend/pkg/command/events.go index 2487165533..83ca24c7ca 100644 --- a/services/frontend/pkg/command/events.go +++ b/services/frontend/pkg/command/events.go @@ -8,6 +8,7 @@ import ( "github.com/cs3org/reva/v2/pkg/events/stream" "github.com/cs3org/reva/v2/pkg/rgrpc/todo/pool" "github.com/cs3org/reva/v2/pkg/utils" + "github.com/rs/zerolog" "go-micro.dev/v4/metadata" "google.golang.org/protobuf/types/known/fieldmaskpb" @@ -133,8 +134,17 @@ func AutoAcceptShares(ev events.ShareCreated, autoAcceptDefault bool, l log.Logg continue } - if resp.GetStatus().GetCode() != rpc.Code_CODE_OK { - l.Error().Interface("status", resp.GetStatus()).Str("userid", uid.GetOpaqueId()).Msg("unexpected status code while accepting share") + if code := resp.GetStatus().GetCode(); code != rpc.Code_CODE_OK { + // log unexpected status codes if a share cannot be accepted... + func() *zerolog.Event { + switch code { + // ... not found is not an error in the context of auto-accepting shares + case rpc.Code_CODE_NOT_FOUND: + return l.Debug() + default: + return l.Error() + } + }().Interface("status", resp.GetStatus()).Str("userid", uid.GetOpaqueId()).Msg("unexpected status code while accepting share") } }