-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
channel with net.http, no deadlock, why #33004
Comments
The built-in deadlock detector only flags states in which the program is guaranteed not to make further progress — it does not flag conditions in which some goroutine is guaranteed not to make progress (which we call “goroutine leaks”). |
That said, the built-in deadlock detector does trigger for the code you've pasted above: https://play.golang.org/p/UvS4MkDtXhx |
@bcmills at playground, it deadlock. but on my mac, it's not, see the picture below |
@georgehao, the deadlock detector is disabled when the C linker is used (see #29322), and as of Go 1.12, Go on macOS uses the C |
@bcmills I see the golang version of playgroud is 1.12.5, it's deadlock. but on my macOS is not. why ? |
The Playground does not use macOS. |
I see, when run the code in linux os, the deadlock appeared. That is, golang invokes system calls don't use C lib on linux OS, it invoke direct ? |
Correct. |
@bcmills oh, my mistake. I just found that I commented the wrong code. When I run the right code on linux, it also don't has the deadlock. see the below |
That's expected. See #33004 (comment). |
@bcmills I test on centos, ubuntu with version 1.10, 1.12.5, 1.12.6, 1.12.7 of the code, all don't have the deadlock. but go playground does, it's interesting |
Whether the deadlock detector triggers may depend on goroutine scheduling and system call implementation details. Fundamentally, your programs — and tests of those programs — should not rely on the behavior of the deadlock detector. It's a useful tool when it triggers, but it's not an adequate substitute for profiling, integration-testing, and load-testing. |
thx @bcmills |
What version of Go are you using (
go version
)?go version go1.12.2 darwin/amd64
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?
if a
channel
without buffer, send data to channel but not receive, it must bedeadlock
, egBut when this build with
net/http
, the deadlock is missing, only block the program, WHYeg
output:
What did you expect to see?
As I see the official document, This
must
get deadlock, but result not.What did you see instead?
deadlock
The text was updated successfully, but these errors were encountered: