-
Notifications
You must be signed in to change notification settings - Fork 17.6k
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
internal/singleflight: results returned by ForgetUnshared do not always seem to be accurate #55343
Comments
working as intended. ForgetUnshared doesn't prevent writes, only that the next call will run. Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only. For questions please refer to https://github.com/golang/go/wiki/Questions |
@seankhliao
|
Is it possible to reopen this issue? |
Duplicated of #31420? The fix seems to not be ported to internal/singleflight. |
Change https://go.dev/cl/433315 mentions this issue: |
@cuonglm Hi, will this fix be released as a minor version of go? 1.19.x? How long is it expected? |
I dont think this is qualified for backporting, so likely no fix for 1.19.x |
So we have to wait until the 1.20 version on February 1st next year? ^_^ |
This problem will affect Based on the above questions, is it possible to publish to 1.19.x? |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I find that the
src/internal/singleflight/singleflight.go ForgetUnshared()
method returns results that are not always expectedFor this I wrote a test code, I copied the code in the src/internal/singleflight/singleflight.go file to the main package, and wrote a main function to test it, if ForgetUnshared() returns correctly, this code It should not panic, because I call cancel() only when there are no other coroutines to share, but the fact that it will panic every time it runs, is there something wrong with my understanding of ForgetUnshared()?
The test code cannot be run in goplay, so I posted a link:
https://gist.github.com/dchaofei/e07547bce17d94c3e05b1b2a7230f62f
In fact, this is a real online environment problem. My application uses http.Client.Do(), but it occasionally has errors: [lookup xxxxx on xxxxx: dial udp xxxxx: operation was canceled], after looking at the code, I found that it may be There is a problem with ForgetUnshared, lookupIPAddr uses ForgetUnshared:
go/src/net/lookup.go
Lines 319 to 337 in 4a4127b
(I have already asked on golang-nuts, but it seems not ideal, so I took the liberty to raise an issue on github😊)
What did you expect to see?
I hope no panic occurs
What did you see instead?
panic: callUUID=[9314284969] err=[context canceled] currentUUId=[6980556786]
The text was updated successfully, but these errors were encountered: