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

Fix panic when Subscriber is closed during explicit Sync #49

Merged
merged 4 commits into from
Jun 7, 2023

Conversation

gammazero
Copy link
Collaborator

If the Subscriber is closed during an explicit Sync, items used by the explicit sync may become invalid. If the events channel is closed and the explicit sync tries to write to it, the a panic will happen.

This is fixed by using a sync.WaitGroup to track the explicit syncs in progress and a synchronized variable to prevent any additional explicit Sync calls during close.

If the Subscriber is closed during an explicit Sync, items used by the explicit sync may become invalid. If the events channel is closed and the explicit sync tries to write to it, the a panic will happen.

This is fixed by using a sync.WaitGroup to track the explicit syncs in progress and a synchronized variable to prevent any additional explicit Sync calls during close.
@gammazero gammazero requested a review from ischasny June 7, 2023 18:05
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2023

Codecov Report

Patch coverage: 75.00% and project coverage change: +0.09 🎉

Comparison is base (9e14275) 52.50% compared to head (7b78f32) 52.60%.

❗ Current head 7b78f32 differs from pull request most recent head 32188c4. Consider uploading reports for the commit 32188c4 to get more accurate results

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #49      +/-   ##
==========================================
+ Coverage   52.50%   52.60%   +0.09%     
==========================================
  Files          59       59              
  Lines        4706     4722      +16     
==========================================
+ Hits         2471     2484      +13     
- Misses       1967     1969       +2     
- Partials      268      269       +1     
Impacted Files Coverage Δ
dagsync/subscriber.go 76.53% <75.00%> (-0.05%) ⬇️

... and 1 file with indirect coverage changes

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

@github-actions
Copy link

github-actions bot commented Jun 7, 2023

Suggested version: v0.2.1

Comparing to: v0.2.0 (diff)

Changes in go.mod file(s):

(empty)

gorelease says:

# diagnostics
required module github.com/microcosm-cc/bluemonday@v1.0.1 retracted by module author: Retract older versions as only latest is to be depended upon

# summary
Suggested version: v0.2.1

gocompat says:

Your branch is up to date with 'origin/main'.

Cutting a Release (and modifying non-markdown files)

This PR is modifying both version.json and non-markdown files.
The Release Checker is not able to analyse files that are not checked in to main. This might cause the above analysis to be inaccurate.
Please consider performing all the code changes in a separate PR before cutting the release.

Automatically created GitHub Release

A draft GitHub Release has been created.
It is going to be published when this PR is merged.
You can modify its' body to include any release notes you wish to include with the release.

@gammazero gammazero merged commit 0406169 into main Jun 7, 2023
@gammazero gammazero deleted the fix-sync-during-close branch June 7, 2023 18:38
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