#698·gopherjs

Tight loop in goroutine never yields

Author: 200scCreated Sep 7, 2017Updated May 11, 2026

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

go1.9 windows/amd64

What version of GopherJS are you using ?

GopherJS 1.9-1

What did you do?

I ran gopherjs build on this program (with GOOS = darwin) and loaded it in my browser.

What did you expect to see?

Well, I expected it to crash at some point or another as I've been struggling with getting this engine running in GopherJS for a while and incrementally fixing crashes as I find them. This crash happens to be out of my control without rewriting the content for building with js, or so it seems.

I expected this loop to give up its cpu time to other goroutines sometimes, as it does when built with go for windows or linux (I don't have a mac to test darwin, but as of maybe a month ago it also worked there).

What did you see instead?

Keyhold loop never stops being printed, and all other goroutines cease advancing. (All fmt debug prints were added in order to find out where this hold up was, and so if fmt.Println("Keyhold loop") is removed, nothing changes.)

I understand the codebase for the engine is a bit much to parse through, so if requested I can attempt to put together a smaller demonstrative case.