Skip to content
This repository has been archived by the owner on May 18, 2023. It is now read-only.

Fix race condition on 'now' when creating a timer #58

Merged
merged 1 commit into from
May 18, 2023

Conversation

mjte-riot
Copy link
Contributor

This is a proposed solution to issue #57

The proposed solution is to capture m.now within the lock and use it subsequently after the lock is released. The added test case is somewhat fabricated in order to reproduce the issue initially using go test ./... -race -count=1.

Copy link
Collaborator

@djmitche djmitche left a comment

Choose a reason for hiding this comment

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

This looks like a good fix. I thought I ran through this file and checked that all m.* access was done with m.mu held, but I guess I missed at least two places. If only the compiler could do this for us [cough]!

@benbjohnson I see you made a release recently. I don't use Go day-to-day anymore, so I'm no longer a user of this library. Would you like to resume maintenance of this library?

@benbjohnson
Copy link
Owner

I'll go ahead and merge this and the other PR and cut a release. I haven't used this library for a long time so I'll probably archive it and someone can fork it if they're interested.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants