Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed the race condition that led to concurrent map access in a publicshare manager #4472

Merged
merged 2 commits into from
Jan 23, 2024

Conversation

2403905
Copy link

@2403905 2403905 commented Jan 23, 2024

Related Issue owncloud/ocis#8255

@2403905 2403905 requested review from labkode, glpatcern and a team as code owners January 23, 2024 10:28
Copy link
Contributor

@kobergj kobergj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question. Rest looks good 👍

@@ -414,6 +417,9 @@ func (m *manager) UpdatePublicShare(ctx context.Context, u *user.User, req *link

// GetPublicShare gets a public share either by ID or Token.
func (m *manager) GetPublicShare(ctx context.Context, u *user.User, ref *link.PublicShareReference, sign bool) (*link.PublicShare, error) {
m.mutex.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to use a sync.RWMutex instead? We could RLock here for improved performance.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't, because we call revokeExpiredPublicShare inside and it lead to the m.persistence.Write() call

@butonic
Copy link
Contributor

butonic commented Jan 23, 2024

since this is only for the json manager I'm fine with all the mutexes ...

@butonic butonic merged commit 049234c into cs3org:edge Jan 23, 2024
9 checks passed
@micbar micbar mentioned this pull request Jan 26, 2024
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants