Blocking API call rejected in k6 init context
0 reputation · 19 Nov 2023, 20:33 UTC
Goal
Determine whether a k6 initialization routine can call a blocking function such as sleep in the init context, or whether the call must be moved to the default VU function.
Constraints and uncertainty
k6 executes init code once at startup and default code per virtual-user iteration. Blocking APIs are rejected in init to prevent startup stalls, but the exact list of disallowed functions and enforcement behavior can change between k6 releases. The installed version should be treated as a version assumption until checked against release notes.
Questions
- Which blocking APIs are prohibited in the init context for the target k6 version?
- Does moving the blocking call to the default function preserve the intended initialization timing across executors?
- Are there version-specific exceptions or deprecations for init-context restrictions?