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

x/mobile: unix.Connect() return network is unreachable #58987

Open
aztecrabbit opened this issue Mar 12, 2023 · 1 comment
Open

x/mobile: unix.Connect() return network is unreachable #58987

aztecrabbit opened this issue Mar 12, 2023 · 1 comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@aztecrabbit
Copy link

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

$ go version
go version go1.20.2 linux/amd64

Gomobile latest version, using:

$ go install golang.org/x/mobile/cmd/gomobile@latest

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/aztecrabbit/.cache/go-build"
GOENV="/home/aztecrabbit/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/aztecrabbit/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/aztecrabbit/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.20.2"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/aztecrabbit/Developments/Golang/test_unix/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 -fdebug-prefix-map=/tmp/go-build2974479168=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import (
	"fmt"
	"net"

	"golang.org/x/sys/unix"
)

func main() {
	fd, err := unix.Socket(unix.AF_INET6, unix.SOCK_STREAM, unix.IPPROTO_TCP)
	if err != nil {
		panic(err)
	}

	ips, err := net.LookupIP("www.google.com")
	if err != nil {
		panic(err)
	}

	sa := &unix.SockaddrInet6{
		Port: 80,
	}
	copy(sa.Addr[:], ips[0])

	err = unix.Connect(fd, sa)
	if err != nil {
		panic(err)
	}

	fmt.Println("Complete without error")
}

What did you expect to see?

Complete without error

What did you see instead?

android real device

panic: network is unreachable

emulator using context.WithTimeout() 30 seconds

panic: context deadline exceeded

this bug is only affecting go 1.20, go 1.19.4 works fine.

@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Mar 12, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 12, 2023
@cherrymui
Copy link
Member

cc @golang/android

@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile 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

3 participants