verless / verless

A Static Site Generator designed for Markdown-based content with a focus on simplicity and performance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

verless serve runs into race condition when another instance already is serving

dominikbraun opened this issue · comments

Description

Serving a verless project works fine, until you try to serve another project while the first serve is still running:

2020/10/01 23:24:07 rebuild
panic: send on closed channel

goroutine 1 [running]:
github.com/verless/verless/core.RunServe(0xc00001e0d0, 0x7, 0x0, 0x0, 0x0, 0x1f90, 0xc0001cba70, 0x4, 0x4, 0x0, ...)
        /home/circleci/project/core/serve.go:125 +0x3d3
github.com/verless/verless/cli.newServeCmd.func1(0xc0002c6b00, 0xc000587fe0, 0x1, 0x1, 0x0, 0x0)
        /home/circleci/project/cli/serve.go:20 +0xbf
github.com/spf13/cobra.(*Command).execute(0xc0002c6b00, 0xc000587fc0, 0x1, 0x1, 0xc0002c6b00, 0xc000587fc0)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:842 +0x45a
github.com/spf13/cobra.(*Command).ExecuteC(0xc0002718c0, 0x0, 0x0, 0x0)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x350
github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
        /home/circleci/project/cmd/verless/main.go:12 +0x2e

If a project already is served on the same address, verless probably closes one or more channel and another goroutine tries to send from that channel because it doesn't know that serving is not possible.

Reproduce

Steps to reproduce the behavior:

  1. verless serve example
  2. verless serve example in new terminal

verless version

The output of verless version:

verless version v0.4.3
Git tag: v0.4.3
Git commit: b96616f

System information

  • OS: Windows 10
  • 1909