-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
reduce sensitivity of fncache cancellation test #14585
Merged
fspmarshall
merged 4 commits into
master
from
fspmarshall/improve-fncache-cancellation-test
Jul 27, 2022
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ab02676
reduce sensitivity of fncache cancellation test
fspmarshall ed5d788
Merge branch 'master' into fspmarshall/improve-fncache-cancellation-test
rosstimothy b17f1e0
Merge branch 'master' into fspmarshall/improve-fncache-cancellation-test
rosstimothy b761d2d
Merge branch 'master' into fspmarshall/improve-fncache-cancellation-test
rosstimothy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure, but I think this will panic on a 32-bit arch. We've already had issues like that #11822
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just use stdlib atomic int64 for now? Next version of Go will have a built-in atomic bool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jakule @zmb3 I think I can answer both questions at the same time:
We started using
go.uber.org/atomic
a couple years back precisely because of issues w/ alignment (and the generally poor standard library API).go.uber.org/atomic
automatically handles alignment and protects from non-atomic access. #11822 wouldn't have happened if we'd been better about usinggo.uber.org/atomic
everywhere. IMO we should keep preferringgo.uber.org/atomic
over the standard library's API until we get togo1.19
(when the standard library will start exposing an equivalent API of its own).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is entirely true, ex: uber-go/atomic#105
But I checked, and this use seems to work on the 32bit arch. I didn't realize that this is
uber
atomic, notstdlib
.I agree with @zmb3 that we should prefer stuff that is in the stdlib, but atomics is one of those things that so far causes us a lot of problems, and Go 1.19 is not available for us now.
@fspmarshall Do you know why did we decide to stop using Uber atomics?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider the linked issue to be an abuse of the API rather than a failure of the library. They are manually dereferencing the wrapper returned by
NewDuration()
, which breaks alignment. IMO if you're dereferencing opaque types returned by concurrency libraries, you should expect some problems 😬If we stopped, I certainly wasn't aware of it. I always encourage people to use it when I'm reviewing, and I use it in all the code I write 🤷 The team was a lot smaller back then. Probably just something that got lost along the way.
We do deliberately avoid it in the
api
package because we are a more aggressive about introducing external deps in there.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we/I just lost the context. When I was looking at our code, I wasn't aware that we were using Uber atomics as most of the usage that I saw used the
std
library.