Skip to content

panic: concurrent write to websocket connection when hot reloading changes to a .tsx file. #15

@yesudeep

Description

@yesudeep

I generated an example using gossr-cli create and had to add the Layout.tsx file manually. However,
when running the application, the hot reloading functionality panics with the following error on
Linux running on an amd64 machine.

zsh❯ go run main.go
8:05PM INF Running go-ssr in development mode
8:05PM DBG Starting type converter
8:05PM DBG Starting hot reload server

   ____    __
  / __/___/ /  ___
 / _// __/ _ \/ _ \
/___/\__/_//_/\___/ v4.11.1
High performance, minimalist Go web framework
https://echo.labstack.com
____________________________________O/_______
                                    O\
8:05PM INF Hot reload websocket running on port 3001
⇨ http server started on [::]:8080
8:05PM INF File changed: /home/yesudeep/code/ofo/frontend/src/components/Counter.tsx, reloading
8:05PM INF File changed: /home/yesudeep/code/ofo/frontend/src/components/Counter.tsx, reloading
panic: concurrent write to websocket connection

goroutine 218 [running]:
github.com/gorilla/websocket.(*messageWriter).flushFrame(0xc001e11ec8, 0x1, {0xc001b76250?, 0x7f7818321230?, 0x7f786279ba68?})
        /home/yesudeep/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:632 +0x4b8
github.com/gorilla/websocket.(*Conn).WriteMessage(0xc0002f06e0, 0xc0001d6360?, {0xc001b76250, 0x6, 0x6})
        /home/yesudeep/go/pkg/mod/github.com/gorilla/[email protected]/conn.go:785 +0x127
github.com/natewong1313/go-react-ssr.(*HotReload).broadcastFileUpdateToClients(0xc0000e4600, {0xc00074c820?, 0x1, 0xc0002840f0?})
        /home/yesudeep/go/pkg/mod/github.com/natewong1313/[email protected]/hotreload.go:159 +0x10f
created by github.com/natewong1313/go-react-ssr.(*HotReload).startWatcher in goroutine 9
        /home/yesudeep/go/pkg/mod/github.com/natewong1313/[email protected]/hotreload.go:124 +0x5d9
exit status 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions