Skip to content

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

Description

@hwware

Test steps:

  1. Create a new module hellovalkey.c file under $ValkeyPath/module/hellovalkey folder

hellovalkey.zip

  1. Create a version.script file

module {
global: RedisModule_OnLoad;
local: *;
};

  1. Create a Makefile

CC=cc
CFLAGS=-g -O2 -fPIC -Wall -shared
LDFLAGS=
LIBS=

all::
${CC} ${CFLAGS} -I../../src -o hellovalkey.so hellovalkey.c ${LDFLAGS} ${LIBS} -Wl,--version-script=version.script

clean::
rm -f *.so *.o

  1. compile the module, and we can get hellovalkey.so
  2. When you load the hellovalkey module, you will get the following error in server side:

433050:M 28 May 2024 15:18:15.582 # Module /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so does not export ValkeyModule_OnLoad() or RedisModule_OnLoad() symbol. Module not loaded.

and you will get the following error in client side:

172.25.0.58:7000> module load /home/ubuntu/valkey-oss/module/hellovalkey/hellovalkey.so
(error) ERR Error loading the extension. Please check the server logs.

  1. Update the version.script as following:

module {
global: ValkeyModule_OnLoad;
local: *;
};

  1. compile the hellovalkey module again, and you will get the correct result

image

Here is the link for what the version.script is https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_node/ld_25.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions