Automattic / Automattic/kue

Kue prefix should be checked for invalid characters

Open
#1,108 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.4k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

I had a very annoying issue on our Kue where sometimes jobs would get stuck in the inactive state.

After understanding how Kue handles this problem with the ``watchStuckJobs`` I came to realize that the LUA script that is supposed to synchronize the Kue is using a regular expression with the Kue prefix.

If the Kue prefix contains any special characters this regular expression "breaks" and the LUA interpreter throws an error since the result of the regular expression returns as nil, this error never bubbles up, it just causes the ``watchStuckJobs`` to clear its interval and never run again.

I would propose to:

- Make it very clear in the documentation that the prefix must not contain any characters other than ``[a-z][A-Z][0-9]`` just to be safe
- Maybe check the Kue prefix to make sure its valid
- If there is a LUA script error, log it somewhere or emit an error event on the Kue

Thanks

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with watchStuckJobs and the Lua script that synchronizes Kue, tracing how the Kue prefix enters its regular expression and how script errors affect the interval. Determine the intended handling for invalid prefixes and Lua failures, then verify that stuck-job watching no longer silently stops and that the chosen behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, lua
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.