Hijack deadlock issue

Please answer these questions before submitting your issue. Thanks!

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

go version go1.8beta2 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/septs/.goenv"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build373922980=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"

What did you do?

PoC
see https://play.golang.org/p/23AuanjGHM

What did you expect to see?

fix it

What did you see instead?

image

see https://github.com/golang/go/issues/18750

Your program panics because you end up with all goroutines blocked on channel operations.

Hey @Septs,

You haven’t really specified what you are trying to do, so I’m just going to make a guess here.

It seems to me that you aren’t really sure what you are meant to use Hijack for, so just incase that is what you are finding hard to fix, this might be what you’re trying to do:

https://play.golang.org/p/XP591TJQSE.

Just for the record, you can write regular questions here, It’s not like the issue tracker on Github :stuck_out_tongue:

Edit: By the way, the reason the example above prevents a deadlock, is because once your connection above has started, your program is stuck trying to read from the pipe which can only happen once the write part of the pipe is closed (if I recall correctly) but above I’m closing the Hijacked connection which uses the pipe.

For a different example, this will also read from the pipe: https://play.golang.org/p/1Ob-jIuGCW.

1 Like

@radovskyb cgo does not work that way

Sorry, you’re going to have to be more specific than that lol…

Are you trying to implement deadline’s for the pipes, since you posted the pipe code?

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