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

net: Read does not obey deadline after syscall.Recvfrom or syscall.Recvmsg is called #65143

Open
jimsnab opened this issue Jan 17, 2024 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jimsnab
Copy link

jimsnab commented Jan 17, 2024

Go version

go1.21.6 linux/amd64

Output of go env in your module/workspace:

O111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/jims/.cache/go-build'
GOENV='/home/jims/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/jims/go/pkg/mod'
GONOPROXY='github.com/jimsnab'
GONOSUMDB='github.com/jimsnab'
GOOS='linux'
GOPATH='/home/jims/go'
GOPRIVATE='github.com/jimsnab'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/tmp/isconn/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1248113131=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Code is here: https://go.dev/play/p/nr6grgosOXV

In one terminal, run ./isconn srv which will open a socket and accept one client connection, and while holding the client connection open, the connection state is checked via Recvfrom.

In another terminal, run ./isconn cli which will connect to the test server and perform a Read() every 250ms which is always expected to time out. Then after timeout, connection state is checked via Recvfrom.

What did you see happen?

After Recvfrom returns, the next client Read is blocking. The SetReadDeadline ahead of it does not work.

What did you expect to see?

Every 250ms the Read call is issued and then times out.

Comment out the call to Recvfrom and that's what it will do.

@bcmills bcmills changed the title net & syscall: Read does not obey deadline after Recvfrom or Recvmsg is called net,syscall: Read does not obey deadline after Recvfrom or Recvmsg is called Jan 17, 2024
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 17, 2024
@jimsnab
Copy link
Author

jimsnab commented Jan 17, 2024

The test program is also at https://github.com/jimsnab/go-isconn

@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 19, 2024
@cagedmantis cagedmantis added this to the Backlog milestone Jan 19, 2024
@cagedmantis
Copy link
Contributor

cc @neild @golang/runtime

@mknyszek
Copy link
Contributor

In compiler/runtime triage, we're not really sure what the correct semantics are here. net has abstractions on top of syscall and I don't know whether those are guaranteed to translate into the raw syscall layer. My guess would be "no" but I think we need @neild to comment.

@mknyszek mknyszek changed the title net,syscall: Read does not obey deadline after Recvfrom or Recvmsg is called net: Read does not obey deadline after syscall.Recvfrom or syscall.Recvmsg is called Jan 24, 2024
@mknyszek mknyszek removed the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants