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

WIP: Run unit & integration tests with go test -race #243

Closed
wants to merge 4 commits into from

Conversation

DMRobertson
Copy link
Contributor

No description provided.

Copy link
Member

@kegsay kegsay left a comment

Choose a reason for hiding this comment

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

If CI is happy, LGTM. What a faff. It would be easier to just use an atomic.Bool for closing perhaps?

@DMRobertson
Copy link
Contributor Author

What a faff.

Yes. I think I'm holding something wrong here.

According to https://go.dev/tour/concurrency/4 (I wish there was a more authoritative reference):

Another note: Channels aren't like files; you don't usually need to close them. Closing is only necessary when the receiver must be told there are no more values coming, such as to terminate a range loop.

I think The Right Thing might be to make PubSub.Close not close channels?

@kegsay
Copy link
Member

kegsay commented Aug 16, 2023

If you don't close channels and the channel is spread over >1 goroutine, then the goroutine will leak in cases where you have:

go func() {
    for val := range ch {
    }
}()

as the for loop only terminates when the channel is closed.

@kegsay
Copy link
Member

kegsay commented Oct 11, 2023

I did half of this in #337 - need to go through the data races in integ tests.

@kegsay
Copy link
Member

kegsay commented Mar 11, 2024

#410

@kegsay kegsay closed this Mar 11, 2024
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