muesli / beehive

A flexible event/agent & automation system with lots of bees ๐Ÿ
GNU Affero General Public License v3.0
6.28k stars 319 forks source link

Panic in case of external command error #288

Closed crile closed 4 years ago

crile commented 4 years ago

Hi,

I want to use the execute command hive. I do a simple test with curl http://localhost:8080. In case of error in curl, the server is not running, beehive stops with the following error ๐Ÿ‘

INFO[0999] Finished request                              Duration=4.8803ms Method=GET Response=200 URL=/v1/bees
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0curl: (7) Failed to connect to localhost port 8080: Connection refused
PANI[0999] [curl-error]: Error waiting for Cmd exit status 7
panic: (*logrus.Entry) (0xf3ab40,0xc00012ce00)

goroutine 289 [running]:
github.com/sirupsen/logrus.Entry.log(0xc0000ca000, 0xc00070ecc0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:239 +0x2d5
github.com/sirupsen/logrus.(*Entry).Log(0xc0001c2070, 0x0, 0xc0004add50, 0x1, 0x1)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:268 +0xf4
github.com/sirupsen/logrus.(*Entry).Logln(0xc0001c2070, 0xc000000000, 0xc00015ce00, 0x3, 0x4)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/entry.go:359 +0xda
github.com/sirupsen/logrus.(*Logger).Logln(0xc0000ca000, 0xc000000000, 0xc00015ce00, 0x3, 0x4)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/logger.go:239 +0x86
github.com/sirupsen/logrus.(*Logger).Panicln(...)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/logger.go:280
github.com/sirupsen/logrus.Panicln(...)
        /home/muesli/Sources/go/pkg/mod/github.com/sirupsen/logrus@v1.4.1/exported.go:219
github.com/muesli/beehive/bees.(*Bee).LogFatal(0xc000170640, 0xc000473f28, 0x2, 0x2)
        /home/muesli/Sources/go/src/github.com/muesli/beehive/bees/bees.go:371 +0x166
github.com/muesli/beehive/bees/execbee.(*ExecBee).Action.func1(0xc0004a0a20, 0xc0004a0a30, 0xc000170640)
        /home/muesli/Sources/go/src/github.com/muesli/beehive/bees/execbee/execbee.go:113 +0x5d1
created by github.com/muesli/beehive/bees/execbee.(*ExecBee).Action
        /home/muesli/Sources/go/src/github.com/muesli/beehive/bees/execbee/execbee.go:56 +0x228

I know that I can use the http client hive to do this but it is just an example of external command.


Beehive 0.3.2 (c66102d5e32bffbad9124d41ae2ffd203ee55399) On Windows 10

rubiojr commented 4 years ago

I think this's been fixed somewhat recently, in 8eb5a356b55797dfab49dddc9341df042fc789a7.

You could either build from master or wait for @muesli to release new binaries.

@muesli happy to help if you think master is currently in a releasable state.

muesli commented 4 years ago

Yeah, let's do another release this weekend. This fix alone is probably worth it.

crile commented 4 years ago

Thanks, it works now.