OpenFn / OpenFn/kit

Worker: looking a bit fragile if execute throws

Open
#759 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
21
Forks
23
Avg merge
1d 22h
Merged PRs (30d)
17

Description

The worker's top level execute function has a few places where it might potentially throw.

This would result in the worker crashing and all runs in progess getting lost.

This is obviously quite severe but it's not entirely clear what we should do. The worker has an obligation to try and finish all outstanding work and report back to lightnig.

For example: failure to join the run channel will result in an unhandled exception. At this point something is very wrong. I don't think we can report back to Lightning yet because we've not even been able to join the comms channel (or we were kicked out). So the run is probably lost at this point. We should probably kill the whole worker (but give existing runs a chance to finish)

There are probably a few other equally nefarious places where an error will result in the whole worker crashing. It's a very sensitive bit of code with a lot of asyncrhonicity and dependencies on other systems.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the worker's top-level execute function and trace every operation that can throw, including joining the run channel and reporting back to Lightning. Determine the required behavior for each failure, especially how outstanding runs should finish or be handled when the worker loses its communications channel; done requires an agreed failure policy and coverage of the identified paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.