Drone agent restarting


I have recently started using Drone on a project for testing and building services from a monorepo. Our services being coded in multiple languages, I had to do some tricks to get where I wanted. Since I’ve started using Matrix builds to separate each service I have encountered a bug with the Drone Agent where the Docker container randomly restarts multiple times before finally starting to build.

I have checked the Agent logs and found this:

{"time":"2018-09-19T09:30:23Z","level":"debug","repo":"CaliOpen/Caliopen","build":"90","id":"4557","error":"","exit_code":0,"message":"updating pipeline status"}
{"time":"2018-09-19T09:30:23Z","level":"debug","repo":"CaliOpen/Caliopen","build":"90","id":"4557","message":"stop listening for cancel signal"}
{"time":"2018-09-19T09:30:23Z","level":"debug","repo":"CaliOpen/Caliopen","build":"90","id":"4557","message":"updating pipeline status complete"}
{"time":"2018-09-19T09:30:23Z","level":"debug","message":"request next execution"}
{"time":"2018-09-19T09:30:23Z","level":"debug","repo":"CaliOpen/Caliopen","build":"90","id":"4557","message":"pipeline done"}
panic: runtime error: index out of range

goroutine 24 [running]:
main.(*runner).run(0xc420486280, 0xbf1e40, 0xc420207780, 0x0, 0x0)
	/go/src/github.com/drone/drone/cmd/drone-agent/agent.go:182 +0x170d
main.loop.func2(0xc4202af010, 0xc4202aee9c, 0xbf43a0, 0xc42027cee0, 0xc4201d1a40, 0x0, 0x0, 0xc4202aef70, 0xc4202aefd0)
	/go/src/github.com/drone/drone/cmd/drone-agent/agent.go:132 +0x193
created by main.loop
	/go/src/github.com/drone/drone/cmd/drone-agent/agent.go:137 +0x910
{"time":"2018-09-19T09:30:24Z","level":"debug","message":"request next execution"}
panic: runtime error: index out of range

The drone.yml can be found here.

Thank you for your help!

We’re hitting this as well, currently investigating.

Agent is known to have unstable network connection.

Narrowed to a custom git clone logic.

It’s failing when the event is not in the git plugin event

During deployment :

Works :

    image: plugins/git:next
      event: [ push, pull_request, tag ]
    image: fpfis/true
      event: [ deployment ]

fails :

    image: plugins/git:next
      event: [ push, pull_request, tag ]

We made it … boolean as containers :slight_smile:

So far I made it to https://github.com/drone/drone/blob/master/cmd/drone-agent/agent.go#L478 cc @bradrydzewski , Stages doesn’t seem to be set.

You are totally right, I am able to reproduce the error with a custom clone logic similar to yours.

However, I also faced the problem when using a non-conditional git clone step. I thought it was related to Matrix builds, but I haven’t investigated much as I’m currently moving away from them.

Ok so this is confirmed ! I opened https://github.com/drone/drone/issues/2513 mentioning your issue, hope you don’t mind.