if I process a large list in the setup(), that will meet "context cancelled" issue, and it's ok if I pick a small sub array from this list using slice(...)
export function setup() {
let users = JSON.parse(usersList).slice(0, 8);
var data = [];
for (var i = 0; i < users.length; i++) {
let deviceId = "230a361e-25cc-3e40-bf44-c30761386" + format(i, "000.##");
var temp = secureLogin(users[i], deviceId, "1");
data.push(temp);
}
return data;
};
seams like it's timeout, is there a option to set the expiration time for that?
I just encountered the same behavior : I have a for loop in setup context building the test materials (random stuff), and when the loop take too much time, I get this :
time="2018-05-28T17:41:54Z" level=error msg="Engine error" error="setup: context cancelled at setup [...]"
I dig a little bit and found that the iteration count is not incremented during setup phase, and execution context goes to timeout at this condition :
https://github.com/loadimpact/k6/blob/216bd1ef22b86fb83139e2deb553ad493bb3821d/cmd/run.go#L404
Does anyone have an idea to bypass this ? Maybe add a timeout option and/or simply ignore iteration count for the setup phase ?
The setup() and teardown() timeouts used to be hardcoded to 10 seconds, but since the recently released version 0.21, there's now an option to change that. Try setting this:
export let options = {
setupTimeout: "60s"
};
...or whatever value makes sense in your context. I see that I've forgotten to to add those options in the documentation, so I'll fix that in a bit...
Added the setupTimeout and teardownTimeout to the options docs.
Most helpful comment
The
setup()andteardown()timeouts used to be hardcoded to 10 seconds, but since the recently released version 0.21, there's now an option to change that. Try setting this:...or whatever value makes sense in your context. I see that I've forgotten to to add those options in the documentation, so I'll fix that in a bit...