k6
k6 copied to clipboard
When logging to a file, no logs are written if k6 is killed
trafficstars
Brief summary
If k6 is configured to log to a file and the process is killed in the middle of an execution, log messages produced by console.log instructions executed before the process were killed are lost, and the log file is empty.
k6 version
k6 v0.57.0 (go1.24.0, linux/amd64)
OS
Arch Linux
Docker version and image (if applicable)
No response
Steps to reproduce the problem
Take a simple script like this:
import { sleep } from 'k6'
export default function main() {
console.log(`always log`);
sleep(30);
}
And run it writing logs to a file:
k6 run --log-output=file=log-then-timeout.log log-then-timeout.js
After a few seconds, kill k6:
sleep 3; pkill -KILL k6
Realize that the log file is empty
nadia@Nadiarch curry-admin@Curry
14:44:21 /tmp/nadia $> wc browser-timeout.log
0 0 0 browser-timeout.log
Expected behaviour
I'd expect log-then-timeout.log to contain the always log string.
Actual behaviour
log-then-timeout.log is empty.