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/net/websocket: Getting "unexpected EOF" when trying to connect more than 28 connections to websocket server. #955

Closed
gopherbot opened this issue Jul 25, 2010 · 5 comments

Comments

@gopherbot
Copy link

by inouemak:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Download the attached file
2.  8g websocket.go ; 8l -o websocket websocket.8 ; ./websocket

What is the expected output?

you should see numbers from 0 - 30

What do you see instead?

Get "unexpected EOF' with lots of stack trace around number 28.
See the full error message at http://gist.github.com/489439

What is your $GOOS?  $GOARCH?

[src]$ echo $GOOS
darwin
[src]$ echo $GOARCH
386


Which revision are you using?  (hg identify)

[src]$ hg identify
5992bf56aa72 release.2010-07-14/release

Please provide any additional information below.

Also raised at google group.
http://groups.google.com/group/golang-nuts/browse_thread/thread/3b06510aaa301c38

Attachments:

  1. websocket.go (529 bytes)
@wcn3
Copy link

wcn3 commented Jul 25, 2010

Comment 1:

On the 28th run, the web socket client key 1 ends with 2 space characters.  Since the
websocket code doesn't quote the strings for the key, the 2 trailing spaces are
stripped. This results in the websocket server handler rejecting the GET request and not
returning information. Since the client doesn't read back any information when it
expects to, this causes the unexpected EOF, triggering your panic.
The attached patch to client.go addresses this issue.

Attachments:

  1. patch (586 bytes)

@wcn3
Copy link

wcn3 commented Jul 25, 2010

Comment 2:

The patch above is for websocket/client.go

@adg
Copy link
Contributor

adg commented Jul 26, 2010

Comment 3:

Currently being addressed by:
  http://golang.org/cl/1669056/show

Status changed to Started.

@gopherbot
Copy link
Author

Comment 4 by inouemak:

Hi. Thank you very much for responding for this quickly. I applied the patch and working
fine.
I have a further questions.
1. How did you find out the 2 space characters? Are there any go related debugging
tools, or you just read the code and found out? I just started learning golang, so any
debugging tips are appreciated.
2. How many connections can you make? 
When I tried websocket2.go (see the attached), it starts failing once it reaches over
1000 connections (but the failure timing is not consistent. Sometimes goes more than
15000, and some times fails around 1000). I do expect that I can make at least 20,000
connections easily, as I was able to using ruby websocket server (note: ulimit is set to
100000). I know I should not really make this many connections, but I am kind of trying
to push the boundary, since this is regression test script.
http://gist.github.com/491379
3. Does the script work on all environment? I can make certain number of connections
when I try with OSX. When I try with Linux Ubuntu (Linux vm02.staging.pusherapp.com
2.6.32-305-ec2 #9-Ubuntu SMP Thu Apr 15 04:14:01 UTC 2010 i686 GNU/Linux), I get
"connection refuesed" error message and can not connect any. 
http://gist.github.com/491387

Attachments:

  1. websocket2.go (561 bytes)

@rsc
Copy link
Contributor

rsc commented Sep 11, 2010

Comment 5:

Fixed by http://code.google.com/p/go/source/detail?r=2ccf0549da35.
The number of connections you can make depends more on
the operating system than on Go.  See issue #66.  To keep discussing
the number of simultaneous connections it would be best to
move to golang-nuts@googlegroups.com

Status changed to Fixed.

@mikioh mikioh changed the title Getting "unexpected EOF" when trying to connect more than 28 connections to websocket server. x/net/websocket: Getting "unexpected EOF" when trying to connect more than 28 connections to websocket server. Jul 30, 2015
@mikioh mikioh modified the milestone: Unreleased Jul 30, 2015
@golang golang locked and limited conversation to collaborators Aug 5, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants