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/http: solaris 11.3 protocol wrong type for socket #59359

Closed
karlik8899 opened this issue Apr 1, 2023 · 15 comments
Closed

net/http: solaris 11.3 protocol wrong type for socket #59359

karlik8899 opened this issue Apr 1, 2023 · 15 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. OS-Solaris
Milestone

Comments

@karlik8899
Copy link

What version of Go are you using (go version)?

go version go1.20.2 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOOS="linux"
GOPATH="/home/x/go"
GOPROXY="https://proxy.golang.org"
GOROOT="/opt/go1.20.2"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/go1.20.2/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
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 -fdebug-prefix-map=/tmp/go-build713374419=/tmp/go-build -gno-record-gcc-switches"

What did you do?

   c := http.Client{Timeout: time.Duration(3) * time.Second}
    req, err := http.NewRequest(http.MethodGet, "http://jenkins.x.x:8080/job/"+app+"/lastStableBuild/artifact/", nil)
    panicOnError(err)
    req.SetBasicAuth(user, pwd)
    resp, err := c.Do(req)
    panicOnError(err)

env GOOS=solaris GOARCH=amd64 go build .

What did you expect to see?

no error
This doesn't work for me since version 1.19, the last working version was 1.18.
Is it a bug or is solaris 11.3 no longer supported?

What did you see instead?

Get "http://jenkins.x.x:8080/job/celllocker/lastStableBuild/artifact/": dial tcp: lookup jenkins.nms.ip on x.x.x.x:53: dial udp x.x.x.x:53: socket: protocol wrong type for socket

@mknyszek mknyszek changed the title net/http: solaris 11.3 protocol wrong type for soket net/http: solaris 11.3 protocol wrong type for socket Apr 3, 2023
@mknyszek
Copy link
Contributor

mknyszek commented Apr 3, 2023

CC @neild

@mknyszek mknyszek added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Apr 3, 2023
@mknyszek mknyszek added this to the Backlog milestone Apr 3, 2023
@ianlancetaylor
Copy link
Contributor

CC @golang/solaris

The error is that the socket system call is returning EPROTOTYPE, which is documented as "The socket type is not supported by the protocol." I don't understand how that could be; as far as I can tell we always pass 0 for the protocol. What are the contents of the file /etc/netconfig on your system?

@karlik8899
Copy link
Author

/etc/netconfig Output
#
# Copyright 1999 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I%     %E% SMI"
#
# The "Network Configuration" File.
#
# Each entry is of the form:
#
#            \
#                
#
# The "-" in  for inet family transports indicates
# redirection to the name service switch policies for "hosts" and
# "services". The "-" may be replaced by nametoaddr libraries that
# comply with the SVr4 specs, in which case the name service switch
# will not be used for netdir_getbyname, netdir_getbyaddr,
# gethostbyname, gethostbyaddr, getservbyname, and getservbyport.
# There are no nametoaddr_libs for the inet family in Solaris anymore.
#
udp6       tpi_clts      v     inet6   udp    /dev/udp6       -
tcp6       tpi_cots_ord  v     inet6   tcp    /dev/tcp6       -
udp        tpi_clts      v     inet    udp    /dev/udp        -
tcp        tpi_cots_ord  v     inet    tcp    /dev/tcp        -
rawip      tpi_raw       -     inet    -      /dev/rawip      -
ticlts     tpi_clts      v    loopback -      /dev/ticlts     straddr.so
ticotsord  tpi_cots_ord  v    loopback -      /dev/ticotsord  straddr.so
ticots     tpi_cots      v    loopback -      /dev/ticots     straddr.so

@karlik8899
Copy link
Author

if it helps here is the output from sotruss
sotruss-out-go1.18.txt
sotruss-out-go1.20.txt

@ianlancetaylor
Copy link
Contributor

Thanks for the data. Unfortunately I have no idea what is going on.

@xmikus01
Copy link

This CL 403394 and commit introduced support for the accept4 syscall on Solaris (commit message refers to Solaris 11.4), but unfortunately also introduced passing of SOCK_* flags to the socket syscall unconditionally for all versions of Solaris by introducing solaris to build flags of src/net/sock_cloexec.go.

However, these SOCK_* flags are only available only in Solaris 11.4 and later:

Support for SOCK_* flags as part of the type parameter was added to Oracle Solaris in the 11.4 release.

@tklauser @ianlancetaylor The question is, which Solaris version is officially supported by the Go team? If it is also 11.3, then of course this is a regression...

@ianlancetaylor
Copy link
Contributor

On https://go.dev/wiki/MinimumRequirements we claim to support Solaris 11+, which presumably includes 11.3.

So I think we may need to revert https://go.dev/cl/403634.

@ianlancetaylor
Copy link
Contributor

@xmikus01 Thanks for digging through this.

@gopherbot
Copy link

Change https://go.dev/cl/501276 mentions this issue: Revert "net: remove fallback path in sysSocket"

@gopherbot
Copy link

Change https://go.dev/cl/501275 mentions this issue: Revert "internal/poll: remove fallback path in accept"

gopherbot pushed a commit that referenced this issue Jun 7, 2023
This reverts CL 422375.

Reason for revert: We still need the fallback path on Solaris.

For #45964
For #59359

Change-Id: Ie598b9ef180708fb157080015aee44f67f6737c4
Reviewed-on: https://go-review.googlesource.com/c/go/+/501275
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
@gopherbot
Copy link

Change https://go.dev/cl/501636 mentions this issue: internal/poll: update SOCK_CLOEXEC comment

gopherbot pushed a commit that referenced this issue Jun 7, 2023
For #45964
For #59359

Change-Id: I9f8f4c17ccd9711f81d152953a5e6aea50c6a28f
Reviewed-on: https://go-review.googlesource.com/c/go/+/501636
Run-TryBot: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
gopherbot pushed a commit that referenced this issue Jun 9, 2023
This reverts CL 40364.

Reason for revert: Fallback path is still required on Solaris.

For #45964
For #59359

Change-Id: I4b8c8af77ee987cad6617221793b90c9a8829c3e
Reviewed-on: https://go-review.googlesource.com/c/go/+/501276
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@gopherbot
Copy link

Change https://go.dev/cl/501939 mentions this issue: net: update SOCK_CLOEXEC comment

gopherbot pushed a commit that referenced this issue Jun 9, 2023
For #45964
For #59359

Change-Id: I7fd295a096e5776102e057789d157da681df9073
Reviewed-on: https://go-review.googlesource.com/c/go/+/501939
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@tklauser
Copy link
Member

I think this can be closed now that https://go.dev/cl/403634 and https://go.dev/cl/422375 were reverted.

@gopherbot
Copy link

Change https://go.dev/cl/576415 mentions this issue: net: implement the fast path of setting SOCK_NONBLOCK and SOCK_CLOEXEC on Solaris

@gopherbot
Copy link

Change https://go.dev/cl/577175 mentions this issue: net: separate the Solaris fast/slow path of setting SOCK_* from others

gopherbot pushed a commit that referenced this issue Apr 14, 2024
Along with the removal of the slow path from Linux and *BSD.

For #59359

Change-Id: I6c79594252e5e5f1c1c57c11e09458fcae3793d2
Reviewed-on: https://go-review.googlesource.com/c/go/+/577175
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Andy Pan <panjf2000@gmail.com>
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. OS-Solaris
Projects
None yet
Development

No branches or pull requests

6 participants