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

Protect RemoveValue from race condition #2472

Merged
merged 1 commit into from
Feb 23, 2023
Merged

Protect RemoveValue from race condition #2472

merged 1 commit into from
Feb 23, 2023

Conversation

blinkbean
Copy link
Contributor

When multiple gouroutines are trying to remove values from the same garray. After one routine calculate the index to remove, the other one could have removed the value before the calculated index, causing the index to shift and remove the wrong element. Making both the search and remove action atomic solve this problem.

When multiple gouroutines are trying to remove values from the same
garray. After one routine calculate the index to remove, the other
one could have removed the value before the calculated index, causing
the index to shift and remove the wrong element. Making both the
search and remove action atomic solve this problem.
@codecov-commenter
Copy link

Codecov Report

Base: 79.98% // Head: 80.03% // Increases project coverage by +0.04% 🎉

Coverage data is based on head (9879fb9) compared to base (adf90c8).
Patch coverage: 100.00% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2472      +/-   ##
==========================================
+ Coverage   79.98%   80.03%   +0.04%     
==========================================
  Files         599      596       -3     
  Lines       49779    49446     -333     
==========================================
- Hits        39816    39573     -243     
+ Misses       8006     7936      -70     
+ Partials     1957     1937      -20     
Flag Coverage Δ
go-1.15-386 ?
go-1.15-amd64 ?
go-1.16-386 80.00% <100.00%> (-0.01%) ⬇️
go-1.16-amd64 80.00% <100.00%> (-0.02%) ⬇️
go-1.17-386 ?
go-1.17-amd64 ?
go-1.18-386 ?
go-1.18-amd64 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
container/garray/garray_sorted_any.go 95.95% <100.00%> (+0.01%) ⬆️
container/garray/garray_sorted_int.go 97.29% <100.00%> (+0.01%) ⬆️
container/garray/garray_sorted_str.go 97.14% <100.00%> (+0.01%) ⬆️
os/gcron/gcron_schedule_fix.go 81.81% <0.00%> (-9.10%) ⬇️
os/gfsnotify/gfsnotify_watcher_loop.go 78.15% <0.00%> (-5.05%) ⬇️
contrib/registry/zookeeper/zookeeper_watcher.go 48.88% <0.00%> (-2.23%) ⬇️
os/glog/glog_logger_rotate.go 61.99% <0.00%> (-1.36%) ⬇️
container/gtree/gtree_avltree.go 95.40% <0.00%> (-0.58%) ⬇️
contrib/drivers/oracle/oracle.go
contrib/config/kubecm/kubecm.go
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gqcn gqcn merged commit cbbfd85 into gogf:master Feb 23, 2023
@gqcn
Copy link
Member

gqcn commented Feb 23, 2023

@blinkbean Thanks for your contribution! it's awesome!

@gqcn gqcn added the awesome It's awesome! We keep watching. label Feb 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awesome It's awesome! We keep watching.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants