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

Open
karlik8899 opened this issue Apr 1, 2023 · 6 comments
Open

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

karlik8899 opened this issue Apr 1, 2023 · 6 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
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...

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