Setsockopt: invalid argument in net/http.*Server.Serve

I’m getting very strange errors in I can’t reproduce locally on my macOS 10.14.6 (there the tests work just fine!):

set tcp> setsockopt: invalid argument

Tried both TravisCI and CircleCI but neither worked as you can see:

The error is returned by net/http.*Server.Serve right here:

All I did is I’ve implemented the keep-alive listener myself: and made it take a free port automatically when none is given:

Any idea what this error might be caused by?


I’ve commented out the following lines:

if err := tc.SetKeepAlive(true); err != nil {
	return nil, err
if err := tc.SetKeepAlivePeriod(ln.KeepAliveDuration); err != nil {
	return nil, err

And now the tests work on TravisCI too.

Now I’m wondering why this is happening?!


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.