nitishm / vegeta-server

A RESTful API server for vegeta, a load testing tool written in Go.
MIT License
63 stars 17 forks source link

Vegeta attacker does not stop attacking on Cancel #50

Closed nitishm closed 5 years ago

nitishm commented 5 years ago

Describe the bug When /api/v1/attack/<attackID>/cancel is invoked on an attack in Running state, the go routine exits and marks the attack as Canceled but the vegeta attack still continues in the background.

INFO[0011] canceling attack                              ID=86727dd6-7ec3-4031-85dc-4fcadd39373b ToCancel=true component=dispatcher
[GIN] 2019/02/18 - 17:48:58 | 200 |     143.206µs |             ::1 | POST     /api/v1/attack/86727dd6-7ec3-4031-85dc-4fcadd39373b/cancel
WARN[0011] task was canceled86727dd6-7ec3-4031-85dc-4fcadd39373b  ID=86727dd6-7ec3-4031-85dc-4fcadd39373b Status=canceled component=task
[GIN] 2019/02/18 - 17:48:58 | 200 |      94.847µs |             ::1 | GET      /api/v1/attack
[GIN] 2019/02/18 - 17:48:59 | 200 |      72.283µs |             ::1 | GET      /api/v1/attack
[GIN] 2019/02/18 - 17:49:00 | 200 |      89.406µs |             ::1 | GET      /api/v1/attack
[GIN] 2019/02/18 - 17:49:01 | 200 |     103.727µs |             ::1 | GET      /api/v1/attack
[GIN] 2019/02/18 - 17:49:02 | 200 |      63.409µs |             ::1 | GET      /api/v1/attack

To Reproduce Submit attack with following body

{
    "rate": 10,
    "duration": "50s",
    "target": {
        "method": "GET",
        "URL": "http://localhost:80/api/v1/report",
        "scheme": "http"
    }
}

and invoke cancel.

Expected behavior The vegeta attack stops as well.