Skip to content

Fix module loading failure for redis module#3374

Merged
PingXie merged 8 commits into
valkey-io:unstablefrom
roshkhatri:fix-crash-#547
Jun 10, 2026
Merged

Fix module loading failure for redis module#3374
PingXie merged 8 commits into
valkey-io:unstablefrom
roshkhatri:fix-crash-#547

Conversation

@roshkhatri

@roshkhatri roshkhatri commented Mar 18, 2026

Copy link
Copy Markdown
Member

Fixes #547

@codecov

codecov Bot commented Mar 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.92%. Comparing base (948aaf8) to head (32c85a1).

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3374      +/-   ##
============================================
+ Coverage     76.68%   76.92%   +0.24%     
============================================
  Files           162      162              
  Lines         80729    80729              
============================================
+ Hits          61903    62098     +195     
+ Misses        18826    18631     -195     

see 23 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.

@hpatro hpatro requested a review from PingXie March 18, 2026 07:18
@hpatro

hpatro commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

@roshkhatri How did you test it ?

@roshkhatri

Copy link
Copy Markdown
Member Author

I tested this by loading a the minimal module that is mentioned on the issue #547

@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.

Looks good!

@hpatro

hpatro commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

@roshkhatri Shall we add it as a test then ?

I believe this would be useful for folks to load a Redis compatible module to Valkey if other API(s) are available.

roshkhatri and others added 4 commits March 20, 2026 01:10
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
)

Signed-off-by: Harkrishn Patro <bunty.hari@gmail.com>
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
Probably added by mistake during some merge of valkey-io#1566

Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>

@Nikhil-Manglore Nikhil-Manglore 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

@PingXie PingXie 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. One nit on the makefile rule.

Comment thread tests/modules/Makefile
32bit:
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32"

%.xo: %.c ../../src/valkeymodule.h

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.

We should add a rule to have this new test module file depend on redismodule.h

hellovalkey is the only test module that includes redismodule.h. The
generic %.xo pattern rule only tracks valkeymodule.h, so changes to
redismodule.h would not trigger a rebuild of hellovalkey.xo, defeating
the purpose of this regression test for valkey-io#547.

Addresses review comment from @PingXie.

Signed-off-by: Roshan Khatri <rvkhatri@amazon.com>
@coderabbitai

coderabbitai Bot commented Jun 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47860cea-4ab3-43c8-a245-5dce4bd6466e

📥 Commits

Reviewing files that changed from the base of the PR and between 337003a and 32c85a1.

📒 Files selected for processing (1)
  • tests/modules/Makefile
💤 Files with no reviewable changes (1)
  • tests/modules/Makefile

📝 Walkthrough

Walkthrough

Removes the RedisModule_OnLoad macro alias from the public header and documents that the server supports both ValkeyModule_OnLoad and RedisModule_OnLoad. Adds a test module (hellovalkey) with a version script and Makefile rules, and a unit test that loads and unloads the module verifying the RedisModule_OnLoad path.

Changes

Legacy module symbol support

Layer / File(s) Summary
API contract: remove macro alias
src/redismodule.h
Removes the macro mapping RedisModule_OnLoad to ValkeyModule_OnLoad, replacing it with a comment block explaining the server loads both symbol names natively.
Test module implementation with build rules
tests/modules/Makefile, tests/modules/hellovalkey.c, tests/modules/hellovalkey.version
Adds a minimal test module hellovalkey.c implementing RedisModule_OnLoad, a version script exporting only that symbol, and Makefile rules that depend on redismodule.h and link with a Linux-only --version-script when applicable.
Module load/unload test
tests/unit/moduleapi/redismodule_onload.tcl
Tcl test normalizes the module path, conditionally checks the shared object exports RedisModule_OnLoad on Linux, asserts module load succeeds and emits the legacy init log, then asserts module unload succeeds.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary fix: resolving module loading failure when using the redis module compatibility API.
Description check ✅ Passed The description is well-related to the changeset, referencing the linked issue and explaining the core fix of removing the macro alias.
Linked Issues check ✅ Passed The PR successfully addresses all coding requirements from issue #547: removes the macro alias, maintains server compatibility, adds the hellovalkey module, and establishes build dependencies for test modules.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the module loading issue: header changes, build rule additions, test module implementation, and test coverage are all aligned with the stated objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@roshkhatri roshkhatri requested a review from PingXie June 5, 2026 20:59
@roshkhatri

Copy link
Copy Markdown
Member Author

@PingXie can you please merge this?

@PingXie

PingXie commented Jun 10, 2026

Copy link
Copy Markdown
Member

@roshkhatri there is a test failure?

@roshkhatri

Copy link
Copy Markdown
Member Author

Its not related to the code:

Run mkdir -p tests/tmp
--2026-06-04 20:49:31--  https://download.valkey.io/releases/valkey-7.2.11-noble-x86_64.tar.gz
Resolving download.valkey.io (download.valkey.io)... 13.249.74.8, 13.249.74.7, 13.249.74.55, ...
Connecting to download.valkey.io (download.valkey.io)|13.249.74.8|:443... connected.
HTTP request sent, awaiting response... 403 Forbidden
2026-06-04 20:49:31 ERROR 403: Forbidden.

connection issue with GitHub and the artifacts, you can rerun this test o see if it passes

@roshkhatri

Copy link
Copy Markdown
Member Author

@PingXie all tests passed

@PingXie PingXie merged commit 719268e into valkey-io:unstable Jun 10, 2026
63 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CRASH] If you have version.script file, make sure update Redis* to Valkey*

6 participants