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

Websocket Upgrade blocking forever #246

Closed
truongminh opened this issue Jun 2, 2017 · 8 comments
Closed

Websocket Upgrade blocking forever #246

truongminh opened this issue Jun 2, 2017 · 8 comments

Comments

@truongminh
Copy link

truongminh commented Jun 2, 2017

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

go version go1.8.1 windows/amd64

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

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=E:\Coding\Go\Lib;E:\Coding\Go\Repo
set GORACE=
set GOROOT=D:\Coding\Go
set GOTOOLDIR=D:\Coding\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
set PKG_CONFIG=pkg-config
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2

What did you do?

var upgrader = websocket.Upgrader{
	CheckOrigin: func(r *http.Request) bool {
		return true
	}
}

func (s *RoomServer) upgrade(w http.ResponseWriter, r *http.Request) *websocket.Conn {
   upgrader.Upgrade(w, r, nil)
  // sometime do not reach
}

I found that the piece of code that blocks is the hijack method of http conn

@elithrar
Copy link
Contributor

elithrar commented Jun 2, 2017 via email

@garyburd
Copy link
Contributor

garyburd commented Jun 2, 2017

Possible duplicate of #232.

Check that the system time is correct.

@garyburd
Copy link
Contributor

garyburd commented Jun 2, 2017

The hijack issue was fixed in 1.8.1.

Please report the stack trace of the blocked goroutine. You can get a stack dump by sending the process SIGQUIT.

@truongminh
Copy link
Author

@garyburd it is the hijack issue, exactly.
A test server using golang net/websocket exposes the same problem.
Would you recommend some workaround?

@garyburd
Copy link
Contributor

garyburd commented Jun 2, 2017

You report that you are running Go 1.8.1. The fix for the hijack issue is included in Go 1.8.1.

Check that your system clock is set to the current time.

@truongminh
Copy link
Author

The clock is in 2017. It isn't related to the set read time out for net.Conn mentioned in the above case.

@garyburd
Copy link
Contributor

garyburd commented Jun 4, 2017

Perhaps there's a Windows specific issue with Hijack.

File an issue with the Go project. Include a stack trace of the blocked goroutine.

@truongminh
Copy link
Author

Thank @garyburd for your helps
Closing this issue for now as out of scope.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants