Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error setting up Valkey Search #50

Open
FawenYo opened this issue Feb 27, 2025 · 3 comments
Open

Error setting up Valkey Search #50

FawenYo opened this issue Feb 27, 2025 · 3 comments

Comments

@FawenYo
Copy link

FawenYo commented Feb 27, 2025

Hi, I'm currently trying to run Valkey Search in the container.

I referred to the content in https://github.com/valkey-io/valkey-search/blob/main/.devcontainer/Dockerfile and rewrote the Dockerfile, and here is what it looks like:

# Use Debian bookworm as the base image
FROM debian:bookworm AS builder

RUN apt update && apt-get install -y ca-certificates
# Set non-interactive mode for APT
ENV DEBIAN_FRONTEND=noninteractive
# Install system dependencies
RUN apt-get update && apt-get install -y \
    software-properties-common
RUN echo "deb http://deb.debian.org/debian bookworm-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -y -t bookworm-backports gcc g++ clang

RUN apt-get install -y \
    libc6-dev \
    libc++-dev \
    libc++abi-dev \
    build-essential \
    wget \
    git \
    vim \
    bash \
    bash-completion \
    entr \
    coreutils \
    sudo

RUN rm -rf /var/lib/apt/lists/*

RUN wget https://apt.llvm.org/llvm.sh
RUN chmod +x llvm.sh
RUN ./llvm.sh 17
RUN rm -f llvm.sh
RUN apt-get update && apt-get install -y clang-tidy-17 clang-format-17  && rm -rf /var/lib/apt/lists/*

RUN update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-17 100 && \
    update-alternatives --set clang-tidy /usr/bin/clang-tidy-17
RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100 && \
    update-alternatives --set clang-format /usr/bin/clang-format-17
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-17 100 && \
    update-alternatives --set clang /usr/bin/clang-17
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-17 100 && \
    update-alternatives --set clang++ /usr/bin/clang++-17
RUN update-alternatives --install /usr/bin/clang-cpp clang-cpp /usr/bin/clang-cpp-17 100 && \
    update-alternatives --set clang-cpp /usr/bin/clang-cpp-17
RUN update-alternatives --install /usr/bin/clangd clangd /usr/bin/clangd-17 100 && \
    update-alternatives --set clangd /usr/bin/clangd-17

RUN update-ca-certificates

# Install Bazel/Buildifier
RUN wget -O /usr/local/bin/bazel https://github.com/bazelbuild/bazelisk/releases/latest/download/bazelisk-linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64") && chmod +x /usr/local/bin/bazel
RUN wget -O /usr/local/bin/buildifier https://github.com/bazelbuild/buildtools/releases/download/v8.0.1/buildifier-linux-$([ $(uname -m) = "aarch64" ] && echo "arm64" || echo "amd64") && chmod +x /usr/local/bin/buildifier

# Add bazel/buildifier to PATH
ENV PATH="/usr/local/bin:$PATH"


ARG USER_UID=1000
ENV USER_UID=${USER_UID}
ARG USER_NAME=ubuntu
ENV USER_NAME=${USER_NAME}
ARG USER_GID=1000
ENV USER_GID=${USER_GID}
ARG USER_GNAME=ubuntu
ENV USER_GNAME=${USER_GNAME}

RUN if getent group $USER_GID > /dev/null; then \
    CURRENT_GROUP_NAME=$(getent group $USER_GID | cut -d: -f1); \
    if [ "$CURRENT_GROUP_NAME" != "$USER_GNAME" ]; then \
    groupmod -n $USER_GNAME $CURRENT_GROUP_NAME; \
    fi; \
    elif getent group $USER_GNAME > /dev/null; then \
    GROUP_CURRENT_GID=$(getent group $USER_GNAME | cut -d: -f3); \
    if [ "$GROUP_CURRENT_GID" != "$USER_GID" ]; then \
    groupmod -g $USER_GID $USER_GNAME; \
    fi; \
    else \
    groupadd -g $USER_GID $USER_GNAME; \
    fi
RUN if getent passwd $USER_UID > /dev/null; then \
    CURRENT_USER_NAME=$(getent passwd $USER_UID | cut -d: -f1); \
    if [ "$CURRENT_USER_NAME" != "$USER_NAME" ]; then \
    rm -rf /home/$USER_NAME || true; \
    usermod -l $USER_NAME -g $USER_GID -d /home/$USER_NAME -m $USER_UID; \
    fi; \
    elif getent passwd $USER_NAME > /dev/null; then \
    CURRENT_USER_ID=$(getent passwd $USER_NAME | cut -d: -f3); \
    if [ "$CURRENT_USER_ID" != "$USER_UID" ]; then \
    rm -rf /home/$USER_NAME || true; \
    usermod -u $USER_UID -d /home/$USER_NAME $USER_NAME; \
    fi; \
    else \
    useradd -ms /bin/bash -u $USER_UID -g $USER_GID $USER_NAME; \
    fi
RUN echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers || true;

# Create and set permissions for workspace directory
RUN mkdir -p /workspace && chown -R $USER_NAME:$USER_GNAME /workspace
WORKDIR /workspace

USER $USER_NAME
ENV HOME=/home/$USER_NAME

ENV CC=clang
ENV CXX=clang++

# Clone the repository and build Valkey Search
RUN git clone https://github.com/valkey-io/valkey-search.git && \
    cd valkey-search && \
    bazel build -c opt --config=lto //src:valkeysearch


#################################################################################
FROM valkey/valkey:7.2.5-bookworm AS final

# Copy the built Valkey Search binary from the builder image
COPY --from=builder /workspace/valkey-search/bazel-bin/src/libvalkeysearch.so /usr/local/bin/libvalkeysearch.so

# Entrypoint and CMD from the base image
ENTRYPOINT ["docker-entrypoint.sh"]
CMD ["valkey-server"]

However, when I entered the container and tried to start valkey-search, it will raise the error

# valkey-server "--loadmodule /usr/local/bin/libvalkeysearch.so  --reader-threads 1 --writer-threads 1"
7:C 27 Feb 2025 08:47:33.696 * oO0OoO0OoO0Oo Valkey is starting oO0OoO0OoO0Oo
7:C 27 Feb 2025 08:47:33.696 * Valkey version=7.2.5, bits=64, commit=00000000, modified=0, pid=7, just started
7:C 27 Feb 2025 08:47:33.696 * Configuration loaded
7:M 27 Feb 2025 08:47:33.697 * monotonic clock: POSIX clock_gettime
                .+^+.
            .+#########+.
        .+########+########+.           Valkey 7.2.5 (00000000/0) 64 bit
    .+########+'     '+########+.
 .########+'     .+.     '+########.    Running in standalone mode
 |####+'     .+#######+.     '+####|    Port: 6379
 |###|   .+###############+.   |###|    PID: 7
 |###|   |#####*'' ''*#####|   |###|
 |###|   |####'  .-.  '####|   |###|
 |###|   |###(  (@@@)  )###|   |###|          https://valkey.io
 |###|   |####.  '-'  .####|   |###|
 |###|   |#####*.   .*#####|   |###|
 |###|   '+#####|   |#####+'   |###|
 |####+.     +##|   |#+'     .+####|
 '#######+   |##|        .+########'
    '+###|   |##|    .+########+'
        '|   |####+########+'
             +#########+'
                '+v+'

7:M 27 Feb 2025 08:47:33.698 * Legacy Redis Module /usr/local/bin/libvalkeysearch.so found


=== REDIS BUG REPORT START: Cut & paste starting from here ===
7:M 27 Feb 2025 08:47:33.698 # valkey 7.2.5 crashed by signal: 11, si_code: 1
7:M 27 Feb 2025 08:47:33.698 # Accessing address: (nil)

------ STACK TRACE ------

Backtrace:
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x77e102e82050]
valkey-server *:6379(invalidFunctionWasCalled+0x0)[0x645cad810dd0]
/usr/local/bin/libvalkeysearch.so(RedisModule_OnLoad+0x1c3c)[0x77e101e5d41c]
valkey-server *:6379(moduleLoad+0xe8)[0x645cad87ccb8]
valkey-server *:6379(moduleLoadFromQueue+0x4a)[0x645cad87d01a]
valkey-server *:6379(main+0x789)[0x645cad775a19]
/lib/x86_64-linux-gnu/libc.so.6(+0x2724a)[0x77e102e6d24a]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85)[0x77e102e6d305]
valkey-server *:6379(_start+0x21)[0x645cad775e41]

------ REGISTERS ------
7:M 27 Feb 2025 08:47:33.699 #
RAX:0000000000000000 RBX:0000000000000004
RCX:0000000000000001 RDX:0000000000000001
RDI:00007ffd367d40a0 RSI:000077e1025f7921
RBP:00007ffd367d4080 RSP:00007ffd367d3fd8
R8 :0000645cad9b1d90 R9 :000077e101c02829
R10:0000000000000003 R11:d68b599b0972c33c
R12:000077e1025f7921 R13:00007ffd367d40a0
R14:000077e102a19c20 R15:00007ffd367d40a0
RIP:0000645cad810dd0 EFL:0000000000010246
CSGSFS:002b000000000033
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe7) -> 0000645cada751a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe6) -> 000077e101e5b7e0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe5) -> 00007ffd367d40a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe4) -> 0000645cad8b7851
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe3) -> 0000000000000004
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe2) -> 000077e102f15379
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe1) -> 0000645cada751a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fe0) -> 00007ffd367d40a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fdf) -> 000077e101e5b7e0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fde) -> 00007ffd367d40a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fdd) -> 0000000000000000
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fdc) -> 0000645cada751a0
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fdb) -> 000077e102b21700
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fda) -> 0000645cad779fca
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fd9) -> 0000645cada1ea20
7:M 27 Feb 2025 08:47:33.699 # (00007ffd367d3fd8) -> 000077e101e5d41c

------ INFO OUTPUT ------
# Server
redis_version:7.2.4
server_name:valkey
valkey_version:7.2.5
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:71f00186babe6e79
redis_mode:standalone
os:Linux 6.8.0-49-generic x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:12.2.0
process_id:7
process_supervised:no
run_id:13ef924d0884056705036128a0995cbeda9e910a
tcp_port:6379
server_time_usec:1740646053698798
uptime_in_seconds:0
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:12592805
executable:/data/valkey-server
config_file:
io_threads_active:0

# Clients
connected_clients:0
cluster_connections:0
maxclients:10000
client_recent_max_input_buffer:0
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0
total_blocking_keys:0
total_blocking_keys_on_nokey:0

# Memory
used_memory:883680
used_memory_human:862.97K
used_memory_rss:0
used_memory_rss_human:0B
used_memory_peak:883680
used_memory_peak_human:862.97K
used_memory_peak_perc:inf%
used_memory_overhead:184
used_memory_startup:0
used_memory_dataset:883496
used_memory_dataset_perc:99.98%
allocator_allocated:0
allocator_active:0
allocator_resident:0
total_system_memory:16673042432
total_system_memory_human:15.53G
used_memory_lua:31744
used_memory_vm_eval:31744
used_memory_lua_human:31.00K
used_memory_scripts_eval:0
number_of_cached_scripts:0
number_of_functions:0
number_of_libraries:0
used_memory_vm_functions:32768
used_memory_vm_total:64512
used_memory_vm_total_human:63.00K
used_memory_functions:184
used_memory_scripts:184
used_memory_scripts_human:184B
maxmemory:0
maxmemory_human:0B
maxmemory_policy:noeviction
allocator_frag_ratio:-nan
allocator_frag_bytes:0
allocator_rss_ratio:-nan
allocator_rss_bytes:0
rss_overhead_ratio:-nan
rss_overhead_bytes:0
mem_fragmentation_ratio:-nan
mem_fragmentation_bytes:0
mem_not_counted_for_evict:0
mem_replication_backlog:0
mem_total_replication_buffers:0
mem_clients_slaves:0
mem_clients_normal:0
mem_cluster_links:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.3.0
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

# Persistence
loading:0
async_loading:0
current_cow_peak:0
current_cow_size:0
current_cow_size_age:0
current_fork_perc:0.00
current_save_keys_processed:0
current_save_keys_total:0
rdb_changes_since_last_save:0
rdb_bgsave_in_progress:0
rdb_last_save_time:1740646053
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_saves:0
rdb_last_cow_size:0
rdb_last_load_keys_expired:0
rdb_last_load_keys_loaded:0
aof_enabled:0
aof_rewrite_in_progress:0
aof_rewrite_scheduled:0
aof_last_rewrite_time_sec:-1
aof_current_rewrite_time_sec:-1
aof_last_bgrewrite_status:ok
aof_rewrites:0
aof_rewrites_consecutive_failures:0
aof_last_write_status:ok
aof_last_cow_size:0
module_fork_in_progress:0
module_fork_last_cow_size:0

# Stats
total_connections_received:0
total_commands_processed:0
instantaneous_ops_per_sec:0
total_net_input_bytes:0
total_net_output_bytes:0
total_net_repl_input_bytes:0
total_net_repl_output_bytes:0
instantaneous_input_kbps:0.00
instantaneous_output_kbps:0.00
instantaneous_input_repl_kbps:0.00
instantaneous_output_repl_kbps:0.00
rejected_connections:0
sync_full:0
sync_partial_ok:0
sync_partial_err:0
expired_keys:0
expired_stale_perc:0.00
expired_time_cap_reached_count:0
expire_cycle_cpu_milliseconds:0
evicted_keys:0
evicted_clients:0
total_eviction_exceeded_time:0
current_eviction_exceeded_time:0
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns:0
pubsubshard_channels:0
latest_fork_usec:0
total_forks:0
migrate_cached_sockets:0
slave_expires_tracked_keys:0
active_defrag_hits:0
active_defrag_misses:0
active_defrag_key_hits:0
active_defrag_key_misses:0
total_active_defrag_time:0
current_active_defrag_time:0
tracking_total_keys:0
tracking_total_items:0
tracking_total_prefixes:0
unexpected_error_replies:0
total_error_replies:0
dump_payload_sanitizations:0
total_reads_processed:0
total_writes_processed:0
io_threaded_reads_processed:0
io_threaded_writes_processed:0
reply_buffer_shrinks:0
reply_buffer_expands:0
eventloop_cycles:0
eventloop_duration_sum:0
eventloop_duration_cmd_sum:0
instantaneous_eventloop_cycles_per_sec:0
instantaneous_eventloop_duration_usec:0
acl_access_denied_auth:0
acl_access_denied_cmd:0
acl_access_denied_key:0
acl_access_denied_channel:0

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:cb7da9497e40aca764ec5f7a1563beaef96d0f15
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0

# CPU
used_cpu_sys:0.004126
used_cpu_user:0.005158
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
used_cpu_sys_main_thread:0.004126
used_cpu_user_main_thread:0.005158

# Modules

# Commandstats

# Errorstats

# Latencystats

# Cluster
cluster_enabled:0

# Keyspace

------ CLIENT LIST OUTPUT ------

------ MODULES INFO OUTPUT ------

------ CONFIG DEBUG OUTPUT ------
repl-diskless-sync yes
lazyfree-lazy-server-del no
io-threads 1
list-compress-depth 0
replica-read-only yes
lazyfree-lazy-expire no
lazyfree-lazy-user-flush no
client-query-buffer-limit 1gb
proto-max-bulk-len 512mb
activedefrag no
sanitize-dump-payload no
io-threads-do-reads no
lazyfree-lazy-eviction no
repl-diskless-load disabled
lazyfree-lazy-user-del no
slave-read-only yes

------ FAST MEMORY TEST ------
*** Preparing to test memory region 645cada61000 (2273280 bytes)
*** Preparing to test memory region 645caecad000 (401408 bytes)
*** Preparing to test memory region 77e1025f6000 (40960 bytes)
*** Preparing to test memory region 77e102600000 (8388608 bytes)
*** Preparing to test memory region 77e102e41000 (20480 bytes)
*** Preparing to test memory region 77e10301a000 (53248 bytes)
*** Preparing to test memory region 77e1034a7000 (12288 bytes)
*** Preparing to test memory region 77e103634000 (8192 bytes)
.O.O.O.O.O.O.O.O
Fast memory test PASSED, however your memory can still be broken. Please run a memory test for several hours if possible.

=== REDIS BUG REPORT END. Make sure to include from START to END. ===

       Please report the crash by opening an issue on github:

           http://github.com/valkey-io/valkey/issues

  If a module was involved, please open in the module's repo instead.

  Suspect RAM error? Use valkey-server --test-memory to verify it.

  Some other issues could be detected by valkey-server --check-system
Segmentation fault (core dumped)

I'm not so sure what is going wrong with the libvalkeysearch.so. Any suggestion?

@FawenYo
Copy link
Author

FawenYo commented Feb 27, 2025

Also, I found it would work with no error if I changed my base image's version from 7.2.5-bookworm to 7.2.8-bookworm. Maybe we can document this as a requirement in the document.

@murphyjacob4
Copy link
Collaborator

It looks like this is the Valkey module API bug fixed in valkey-io/valkey#608

This was released in Valkey 7.2.6: https://github.com/valkey-io/valkey/blob/7.2/00-RELEASENOTES#L64-L65

Good idea to document that Valkey >=7.2.6 is required

@FawenYo
Copy link
Author

FawenYo commented Mar 3, 2025

Hi @murphyjacob4 , I've also added the information to the document in the PR #51. Thanks for it!

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

No branches or pull requests

2 participants