golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124.08k stars 17.68k forks source link

tour: local tour scripts fail to connect to the local server #17313

Open KarlisVe opened 8 years ago

KarlisVe commented 8 years ago

When running golang tour on local machine (go tool tour) scripts are not executing: after pressing Run appears "Waiting for remote server..." (see. picture attached) and nothing happens. I am running Windows 10.

golang

Please answer these questions before submitting your issue. Thanks!

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

go1.7.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= set GORACE= set GOROOT=C:\Go set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set CC=gcc set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 set CXX=g++ set CGO_ENABLED=1

What did you do?

If possible, provide a recipe for reproducing the error. A complete runnable program is good. A link on play.golang.org is best.

What did you expect to see?

Result of script execution

What did you see instead?

Waiting for remote server...

odeke-em commented 8 years ago

/cc @adg

adg commented 8 years ago

How are you installing/running the tour?

KarlisVe commented 8 years ago

Installed using msi from https://golang.org/dl/ using default configuration

alexbrainman commented 8 years ago

@KarlisVe it works for me. Please show us the output of your "go tool tour" command - you should see something similar to my output

a

It might have some error message that will help us. Thank you.

Alex

KarlisVe commented 8 years ago

cmd

KarlisVe commented 8 years ago

Also it is interesting that http://127.0.0.1:3999/welcome/1 is accessible only from the browser (FireFox) which started - other browsers does not open the page

alexbrainman commented 8 years ago

@KarlisVe I have no good suggestions on how to debug this. Perhaps others have. Sorry.

Alex

adg commented 8 years ago

Do you have any security software installed? Virus scanners? Firewalls?

adg commented 8 years ago

Also, proxy settings?

KarlisVe commented 8 years ago

@adg Avast Free Antivirus + Standard MS Windows package, no proxy.

aeamaea commented 3 years ago

TL;DR: It works, but you need to use Safari on macOS or reload the page.

Same thing happens on my macbook, if I'm on a a step and the machine goes to sleep, when I wake it back up, the RUN button gives this error "Waiting for local server..." If I cut the URL and paste it in another tab, it works just fine. It seems the client side isn't re-establishing connection (when the machine wakes up) with the local server even though the local server is still running. Reloading the original page affected also "fixes" this issue because the Run button now runs the snippet.

There may be an issue with the client side code, the server seems to be unaffected by the sleep/wakeup.

This problem is reproducible on my MBA macOS 10.12.6 with Chrome (87.0.4280.88 (Official Build) (x86_64)). It doesn't happen when I use Safari to connect to the local gotour server

EDIT: Further to this, inspecting the "KILL" button (run button turns into KILL when it's displaying "Waiting for local..." , it appears the Websocket may be hanging.

script.js:238 WebSocket is already in CLOSING or CLOSED state. send @ script.js:238

The function is:

function send(m) { websocket.send(JSON.stringify(m)); }

WORKAROUND (for me): Reload the page in Chrome on macOS, or use Safari.

golangtour #golang #hangs #gotour

adg commented 3 years ago

Sounds like a Chrome issue. The websocket connection shouldn't go away just because your computer went to sleep.

It could probably be fixed in the gotour code by reconnecting the websocket when it closes. But it's a shame we need to worry about that at all.