tilt-dev/mish

panic on fast restarts of long commands

Opened this issue · 0 comments

gtank commented

I'm consistently getting a panic when one command in a series of them is still running when I press 'r'. This does not happen if there is only one command in the workbook, and I think it's not quite the same crash as #5, but it probably is the one mentioned in #5 (comment)

panic: send on closed channel                                           (1.006s) ✔  
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
goroutine 53 [running]:                                                 1.4s elapsed
github.com/windmilleng/mish/mish/shmill.(*ex).Sh.func1(0xc0001a6100, 0xc000230300, 0x
c000188420, 0xc000272000)
        /home/username/go/src/github.com/windmilleng/mish/mish/shmill/s
hmill.go:176 +0x88
created by github.com/windmilleng/mish/mish/shmill.(*ex).Sh
        /home/username/go/src/github.com/windmilleng/mish/mish/shmill/s
hmill.go:175 +0x327

To repro:

  1. Use this notes.mill:
sh("sleep 1")
sh("sleep 1")
  1. Press 'r' to restart before the first sleep has finished.

Digging into it for a minute, looks like a sync error between the renderer and the executor goroutines (sorry if there are actual names): a channel meant to carry some output gets closed without stopping the associated exec goroutine. I can stop the panics by commenting out this line https://github.com/windmilleng/mish/blob/5a6eea6a31f70e1827ab1a3f7d196e291184cb45/mish/shell.go#L180

Everything looks like it's working after that, but I am sure it has some other consequence.

Regardless, mish just made testing a project a lot nicer, so thanks!