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: getting setsockopt: invalid argument when setting TCP keep-alive on Solaris #64251

Closed
panjf2000 opened this issue Nov 17, 2023 · 6 comments
Assignees
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. OS-Solaris
Milestone

Comments

@panjf2000
Copy link
Member

panjf2000 commented Nov 17, 2023

During my work on CL 542275, I discovered a uncanny failure on Solaris: the existing code of setting the TCP keep-alive via SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE_THRESHOLD, msecs) always failed with setsockopt: invalid argument, resulting in failures from newly added tests:

--- FAIL: TestTCPConnDialerKeepAliveConfig (0.00s)
    tcpconn_keepalive_solaris_test.go:87: TCP_KEEPIDLE: got 7200000ms; want 2s
--- FAIL: TestTCPConnListenerKeepAliveConfig (0.00s)
    tcpconn_keepalive_solaris_test.go:87: TCP_KEEPIDLE: got 7200000ms; want 2s
--- FAIL: TestTCPConnSetKeepAliveConfig (0.00s)
    tcpconn_keepalive_test.go:167: set tcp 127.0.0.1:33957->127.0.0.1:49663: setsockopt: invalid argument

Judging from the failure outputs, I suspect that the existing code of setting keep-alive parameters on solaris had been failing before CL 542275 which only splits the original function setKeepAlivePeriod on solaris and doesn't change how the code used to work, I think there was something wrong with the SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPALIVE_THRESHOLD, msecs) system call on solaris, we just didn't notice this failure because that portion of the code has never been tested.

Filing this bug report for not blocking CL 542275 from an existing bug.

@panjf2000 panjf2000 added help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Nov 17, 2023
@panjf2000 panjf2000 added this to the Backlog milestone Nov 17, 2023
@panjf2000
Copy link
Member Author

cc @neild @bcmills

@bcmills
Copy link
Contributor

bcmills commented Nov 17, 2023

(attn @golang/solaris)

@panjf2000, does it also fail on the illumos builders?

@panjf2000
Copy link
Member Author

panjf2000 commented Nov 18, 2023

I haven't verified it yet, shooting a trybot with TRY=illumos didn't seem to work?
@bcmills

@panjf2000
Copy link
Member Author

Related issue #62254

@panjf2000
Copy link
Member Author

It seemed that it won't fail on illumos according to this.
@bcmills

@gopherbot
Copy link

Change https://go.dev/cl/577195 mentions this issue: net: implement TCP_KEEPIDLE, TCP_KEEPINTVL, and TCP_KEEPCNT on Solaris 11.4

@panjf2000 panjf2000 modified the milestones: Backlog, Go1.23 Apr 8, 2024
@panjf2000 panjf2000 added NeedsFix The path to resolution is known, but the work has not been done. FixPending Issues that have a fix which has not yet been reviewed or submitted. and removed help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Apr 8, 2024
@panjf2000 panjf2000 self-assigned this Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsFix The path to resolution is known, but the work has not been done. OS-Solaris
Projects
None yet
Development

No branches or pull requests

3 participants