Skip to content

Ameliorate crash-loop during worker startup - #1088

Merged
josephjclark merged 9 commits into
mainfrom
fix-worker-validation-timeout-1016
Oct 23, 2025
Merged

josephjclark merged 9 commits into
mainfrom
fix-worker-validation-timeout-1016

Conversation

@taylordowns2000

@taylordowns2000 taylordowns2000 commented Oct 23, 2025 •

Copy link
Copy Markdown
Member

Short Description

Workers were failing intermittently on startup in GKE with "Invalid worker path" errors. The worker would crash and retry several times before eventually succeeding.

Fixes #1016

Implementation Details

Root Cause

The worker validation happens immediately after engine initialization with only a 5-second timeout. In containerized environments, child process initialization can be slower due to:

  • File system delays (overlay fs, network storage)
  • CPU throttling during startup
  • Process spawn timing

Solution

  1. Increased validation timeout from 5s to 15s
  2. Added retry logic with exponential backoff (5 attempts with graceful backoff)

Testing

  • All existing tests pass with updated retry parameter
  • No behavior changes for successful validation (returns immediately)
  • Only affects error path by adding retries before failure

QA Notes

@josephjclark , what's up with my pnpm-lock? Why such a big diff when I run pnpm install? This looks like the thing that causes all the other changes, if i had to guess: https://github.com/OpenFn/kit/pull/1088/files#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbR470

image

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our Responsible AI Policy

Release branch checklist

Delete this section if this is not a release PR.

If this IS a release branch:

  • Run pnpm changeset version from root to bump versions
  • Run pnpm install
  • Commit the new version numbers
  • Run pnpm changeset tag to generate tags
  • Push tags git push --tags

Tags may need updating if commits come in after the tags are first generated.

@github-project-automation github-project-automation Bot moved this to New Issues in Core Oct 23, 2025
@taylordowns2000
taylordowns2000 marked this pull request as ready for review October 23, 2025 08:01
@josephjclark

Copy link
Copy Markdown
Collaborator

Ok this should work well:

  • I've reverted the diff on package lock - no idea what that's about
  • I've tweaked the implementation, added logging of how long the validation takes, and driven the values through options
  • The engine by default does NOT retry
  • But the worker by default will retry three times

@josephjclark
josephjclark merged commit 07861b0 into main Oct 23, 2025
5 of 7 checks passed
@github-project-automation github-project-automation Bot moved this from New Issues to Done in Core Oct 23, 2025
@josephjclark
josephjclark deleted the fix-worker-validation-timeout-1016 branch October 23, 2025 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Worker: engine fails to startup in prod environments

2 participants