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: hangs when connecting to a plain TCP socket #58630

Open
jurisbu opened this issue Feb 22, 2023 · 0 comments
Open

x/net/websocket: hangs when connecting to a plain TCP socket #58630

jurisbu opened this issue Feb 22, 2023 · 0 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@jurisbu
Copy link

jurisbu commented Feb 22, 2023

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

$ go version
go version go1.20.1 linux/amd64
golang.org/x/net v0.7.0

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

What did you do?

Given a dumb TCP server emulated by socat STDIO TCP4-LISTEN:12345,fork, creating a websocket client by dialing to this server locks up the "dialing routine" and I can observe 1 CPU thread use 100%.

// main.go
package main

import (
	"log"
	
	"golang.org/x/net/websocket"
)

func main() {
	origin := "http://localhost/"
	url := "ws://localhost:12345"

	log.Println("Dial ...")

	websocket.Dial(url, "", origin)

	log.Println("Done")
}

What did you expect to see?

  • A failure in WebSocket handshake/upgrade attempt, maybe after a timeout.
  • A way to control network read vi say SetReadDeadline(...) or alike.

What did you see instead?

A thread lockup waiting for network read, probably.

@gopherbot gopherbot added this to the Unreleased milestone Feb 22, 2023
@thanm thanm added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 22, 2023
@seankhliao seankhliao changed the title x/net/websocket: x/net/websocket: hangs when connecting to a plain TCP socket Feb 23, 2023
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

3 participants