Skip to content

Let script continue if busy-reply-threshold is zero#3307

Merged
enjoy-binbin merged 5 commits into
valkey-io:unstablefrom
alon-arenberg:busy-reply-threshold-zero
Mar 5, 2026
Merged

Let script continue if busy-reply-threshold is zero#3307
enjoy-binbin merged 5 commits into
valkey-io:unstablefrom
alon-arenberg:busy-reply-threshold-zero

Conversation

@alon-arenberg

@alon-arenberg alon-arenberg commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

Before we added LUA as a module we had a logic to NOT register the
luaHook when the value of busy-reply-threshold config is set to 0.

Now we ALWAYS register the hook and in order to keep aligned with
old behavior we will let the execution of the script continue from
the interrupt hook when busy-reply-threshold config is set == 0.

And in value.conf, we are saying the config can be negative, but in
fact the config is minimum at 0, fix the valkey.conf as well.

# The default is 5 seconds. It is possible to set it to 0 or a negative value
# to disable this mechanism (uninterrupted execution)

It was introduced in #2858.

@rjd15372 rjd15372 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ranshid ranshid requested a review from enjoy-binbin March 4, 2026 15:16
Signed-off-by: Alon Arenberg <alonare@amazon.com>
@alon-arenberg alon-arenberg force-pushed the busy-reply-threshold-zero branch from cfe7e9f to 5930096 Compare March 4, 2026 15:18

@roshkhatri roshkhatri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

here is where we set hook before

    if (server.busy_reply_threshold > 0 && !debug_enabled) {
        lua_sethook(lua, luaMaskCountHook, LUA_MASKCOUNT, 100000);
        delhook = 1;
    } 

@sarthakaggarwal97 sarthakaggarwal97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it was introduced in #2858.

@enjoy-binbin enjoy-binbin changed the title let script continue if busy-reply-threshold is zero Let script continue if busy-reply-threshold is zero Mar 5, 2026
Comment thread src/script.c Outdated
Signed-off-by: Binbin <binloveplay1314@qq.com>
@enjoy-binbin

Copy link
Copy Markdown
Member

FYI, i update the condition to server.busy_reply_threshold > 0 and update the top comment, that is the old behavior

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait. Please double check the old luaCallFunction and scriptInterrupt. I lost some details here.

@alon-arenberg

Copy link
Copy Markdown
Contributor Author

I think the proposed code change is not correct. Pushing the original commit

…s set to 0

Signed-off-by: Alon Arenberg <alonare@amazon.com>
@enjoy-binbin

enjoy-binbin commented Mar 5, 2026

Copy link
Copy Markdown
Member

i was thinking something like this, can we add this fast path before the elapsedMs?

if (server.busy_reply_threshold == 0) {
        return SCRIPT_CONTINUE;
    }

@enjoy-binbin

Copy link
Copy Markdown
Member

Ran mentions the config is minimum at 0, and the valkey.conf is saying it can be negative, we need to fix the conf as well.

# The default is 5 seconds. It is possible to set it to 0 or a negative value
# to disable this mechanism (uninterrupted execution). Note that in the past
# this config had a different name, which is now an alias, so both of these do
# the same:
# lua-time-limit 5000
# busy-reply-threshold 5000

…alkey.conf

Signed-off-by: Alon Arenberg <alonare@amazon.com>

@enjoy-binbin enjoy-binbin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank!

Signed-off-by: Alon Arenberg <alonare@amazon.com>
@codecov

codecov Bot commented Mar 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.89%. Comparing base (896e9c8) to head (045620f).
⚠️ Report is 5 commits behind head on unstable.

Additional details and impacted files
@@              Coverage Diff              @@
##           unstable    #3307       +/-   ##
=============================================
+ Coverage          0   74.89%   +74.89%     
=============================================
  Files             0      129      +129     
  Lines             0    71549    +71549     
=============================================
+ Hits              0    53588    +53588     
- Misses            0    17961    +17961     
Files with missing lines Coverage Δ
src/script.c 89.24% <100.00%> (ø)

... and 128 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@enjoy-binbin enjoy-binbin merged commit cb9e7c9 into valkey-io:unstable Mar 5, 2026
57 of 58 checks passed
eifrah-aws pushed a commit to eifrah-aws/valkey that referenced this pull request Mar 5, 2026
Before we added LUA as a module we had a logic to NOT register the
luaHook when the value of `busy-reply-threshold` config is set to 0.

Now we ALWAYS register the hook and in order to keep aligned with
old behavior we will let the execution of the script continue from
the interrupt hook when `busy-reply-threshold` config is set == 0.

And in value.conf, we are saying the config can be negative, but in
fact the config is minimum at 0, fix the valkey.conf as well.
```
# The default is 5 seconds. It is possible to set it to 0 or a negative value
# to disable this mechanism (uninterrupted execution)
```

It was introduced in valkey-io#2858.

Signed-off-by: Alon Arenberg <alonare@amazon.com>
Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
hpatro pushed a commit to hpatro/valkey that referenced this pull request Mar 5, 2026
Before we added LUA as a module we had a logic to NOT register the
luaHook when the value of `busy-reply-threshold` config is set to 0.

Now we ALWAYS register the hook and in order to keep aligned with
old behavior we will let the execution of the script continue from
the interrupt hook when `busy-reply-threshold` config is set == 0.

And in value.conf, we are saying the config can be negative, but in
fact the config is minimum at 0, fix the valkey.conf as well.
```
# The default is 5 seconds. It is possible to set it to 0 or a negative value
# to disable this mechanism (uninterrupted execution)
```

It was introduced in valkey-io#2858.

Signed-off-by: Alon Arenberg <alonare@amazon.com>
Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
akashkgit pushed a commit to akashkgit/valkey that referenced this pull request Mar 6, 2026
Before we added LUA as a module we had a logic to NOT register the
luaHook when the value of `busy-reply-threshold` config is set to 0.

Now we ALWAYS register the hook and in order to keep aligned with
old behavior we will let the execution of the script continue from
the interrupt hook when `busy-reply-threshold` config is set == 0.

And in value.conf, we are saying the config can be negative, but in
fact the config is minimum at 0, fix the valkey.conf as well.
```
# The default is 5 seconds. It is possible to set it to 0 or a negative value
# to disable this mechanism (uninterrupted execution)
```

It was introduced in valkey-io#2858.

Signed-off-by: Alon Arenberg <alonare@amazon.com>
Signed-off-by: Binbin <binloveplay1314@qq.com>
Co-authored-by: Binbin <binloveplay1314@qq.com>
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.

5 participants