grafana / xk6-browser

k6 extension that adds support for browser automation and end-to-end web testing via the Chrome Devtools Protocol
https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/browser/
GNU Affero General Public License v3.0
337 stars 42 forks source link

GC browser processes #93

Closed robingustafsson closed 2 years ago

robingustafsson commented 2 years ago

Throughout the development of xk6-browser there's been many times when the browser process or processes have not been properly terminated when k6 exits. Most of the time it's related to k6 panic()'ing but there's also been situations where the orderly closing of the browser hasn't worked properly.

We need to find a way to avoid ever having orphaned browser processes when k6 exits (find a way to get the equivalent of cross-platform cmd.SysProcAttr.Pdeathsig = syscall.SIGKILL). Some ideas:

inancgumus commented 2 years ago

We can temporarily do something to fix this problem in k6Throw, but I think we need the second solution from the k6 side the best: notifying the extension just before an iteration, VU, scenario, or test ends.