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

Resolve concurrent map issue #538

Merged
merged 1 commit into from
May 23, 2023
Merged

Resolve concurrent map issue #538

merged 1 commit into from
May 23, 2023

Conversation

chacha912
Copy link
Contributor

@chacha912 chacha912 commented May 23, 2023

What this PR does / why we need it:

The subscriptionMapByDocID was being accessed and utilized without proper mutex protection.
As a result, a fatal error occurred when simultaneous reads and writes were performed.
To resolve this issue, I added the mutex lock when iterating the map.

Which issue(s) this PR fixes:

Fixes fatal error

image

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Merging #538 (f8a1576) into main (dbcec29) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #538      +/-   ##
==========================================
+ Coverage   50.92%   50.95%   +0.03%     
==========================================
  Files          65       65              
  Lines        5978     5982       +4     
==========================================
+ Hits         3044     3048       +4     
  Misses       2539     2539              
  Partials      395      395              
Impacted Files Coverage Δ
server/backend/sync/memory/coordinator.go 27.58% <100.00%> (-2.42%) ⬇️
server/backend/sync/memory/pubsub.go 44.21% <100.00%> (+3.09%) ⬆️

Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. 👍

@hackerwins hackerwins merged commit 1dd9403 into main May 23, 2023
@hackerwins hackerwins deleted the subscribe-concurrent branch May 23, 2023 08:55
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.

2 participants