Redis 6.2.14 加载模块 librejson.so RedisJSON v2.6.9 时崩溃

问题描述 投票:0回答:1

我能够成功构建和测试 RedisJSON v2.6.9。我在 Amazon Linux 2 上运行 Redis 6.2.14。我是否缺少设置?

NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"
SUPPORT_END="2025-06-30"

当我运行

redis-server --loadmodule ./target/release/librejson.so
时它崩溃了

3374:C 22 Feb 2024 13:14:51.586 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
3374:C 22 Feb 2024 13:14:51.586 # Redis version=6.2.14, bits=64, commit=00000000, modified=0, pid=3374, just started
3374:C 22 Feb 2024 13:14:51.586 # Configuration loaded
3374:M 22 Feb 2024 13:14:51.587 * monotonic clock: POSIX clock_gettime
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 6.2.14 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 3374
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           https://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

3374:M 22 Feb 2024 13:14:51.587 # Server initialized
3374:M 22 Feb 2024 13:14:51.587 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
3374:M 22 Feb 2024 13:14:51.612 * <ReJSON> Created new data type 'ReJSON-RL'
thread '<unnamed>' panicked at /home/ec2-user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/redis-module-2.0.7/src/context/commands.rs:364:1:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5


=== REDIS BUG REPORT START: Cut & paste starting from here ===
3374:M 22 Feb 2024 13:14:51.629 # Redis 6.2.14 crashed by signal: 6, si_code: -6
3374:M 22 Feb 2024 13:14:51.629 # Crashed running the instruction at: 0x7f3298e2bca0

------ STACK TRACE ------
EIP:
/lib64/libc.so.6(gsignal+0x110)[0x7f3298e2bca0]

Backtrace:
/lib64/libpthread.so.0(+0x118e0)[0x7f32991b68e0]
/lib64/libc.so.6(gsignal+0x110)[0x7f3298e2bca0]
/lib64/libc.so.6(abort+0x148)[0x7f3298e2d148]
./target/release/librejson.so(+0x21dd67)[0x7f328ed16d67]
./target/release/librejson.so(+0x21bab9)[0x7f328ed14ab9]
./target/release/librejson.so(+0x21b97a)[0x7f328ed1497a]
./target/release/librejson.so(+0x21b649)[0x7f328ed14649]
./target/release/librejson.so(+0x21a906)[0x7f328ed13906]
./target/release/librejson.so(+0x21b3e0)[0x7f328ed143e0]
./target/release/librejson.so(+0x5ca65)[0x7f328eb55a65]
./target/release/librejson.so(+0x5cb23)[0x7f328eb55b23]
./target/release/librejson.so(+0xf4dd4)[0x7f328ebeddd4]
./target/release/librejson.so(RedisModule_OnLoad+0x197d)[0x7f328ebb9bad]
redis-server *:6379(moduleLoad+0xf8)[0x4c1a28]
redis-server *:6379(moduleLoadFromQueue+0x47)[0x4c1bf7]
redis-server *:6379(main+0x280)[0x430050]
/lib64/libc.so.6(__libc_start_main+0xea)[0x7f3298e1913a]
redis-server *:6379(_start+0x2a)[0x43064a]

------ REGISTERS ------
3374:M 22 Feb 2024 13:14:51.629 #
RAX:0000000000000000 RBX:0000000000000006
RCX:00007f3298e2bca0 RDX:0000000000000000
RDI:0000000000000002 RSI:00007ffd719924f0
RBP:0000000000000000 RSP:00007ffd719924f0
R8 :0000000000000000 R9 :00007ffd719924f0
R10:0000000000000008 R11:0000000000000246
R12:00007f328f02f230 R13:00007f328eff1888
R14:00007f328f02ba30 R15:00007ffd71992880
RIP:00007f3298e2bca0 EFL:0000000000000246
CSGSFS:002b000000000033
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924ff) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924fe) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924fd) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924fc) -> 4000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924fb) -> 0000000000430620
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924fa) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f9) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f8) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f7) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f6) -> 00007ffd719930b8
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f5) -> 0000000000000000
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f4) -> 00007ffd719930a8
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f3) -> 00007ffd71992fe0
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f2) -> 00007ffd71992fd8
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f1) -> 00007ffd719930a0
3374:M 22 Feb 2024 13:14:51.629 # (00007ffd719924f0) -> 0000000000000000

------ INFO OUTPUT ------
# Server
redis_version:6.2.14
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:91899a618ea2f176
redis_mode:standalone
os:Linux 5.10.209-198.858.amzn2.x86_64 x86_64
arch_bits:64
monotonic_clock:POSIX clock_gettime
multiplexing_api:epoll
atomicvar_api:c11-builtin
gcc_version:7.3.1
process_id:3374
process_supervised:no
run_id:07aafbdbb4f9ef255fd5f5066229a6e4d9e3bfad
tcp_port:6379
server_time_usec:1708607691583860
uptime_in_seconds:0
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:14108875
executable:/home/ec2-user/temp/RedisJSON-2.6.9/redis-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

# Memory
used_memory:842120
used_memory_human:822.38K
used_memory_rss:0
used_memory_rss_human:0B
used_memory_peak:842120
used_memory_peak_human:822.38K
used_memory_peak_perc:inf%
used_memory_overhead:0
used_memory_startup:0
used_memory_dataset:842120
used_memory_dataset_perc:100.00%
allocator_allocated:0
allocator_active:0
allocator_resident:0
total_system_memory:4097687552
total_system_memory_human:3.82G
used_memory_lua:30720
used_memory_lua_human:30.00K
used_memory_scripts:0
used_memory_scripts_human:0B
number_of_cached_scripts:0
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_clients_slaves:0
mem_clients_normal:0
mem_aof_buffer:0
mem_allocator:jemalloc-5.1.0
active_defrag_running:0
lazyfree_pending_objects:0
lazyfreed_objects:0

# Persistence
loading: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:1708607691
rdb_last_bgsave_status:ok
rdb_last_bgsave_time_sec:-1
rdb_current_bgsave_time_sec:-1
rdb_last_cow_size: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_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
instantaneous_input_kbps:0.00
instantaneous_output_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
keyspace_hits:0
keyspace_misses:0
pubsub_channels:0
pubsub_patterns: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
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

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:210a3b334b318cf73f6f3f7ffdedc57cdb6125fb
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.000000
used_cpu_user:0.013425
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
used_cpu_sys_main_thread:0.000000
used_cpu_user_main_thread:0.013425

# Modules

# Commandstats

# Errorstats

# Cluster
cluster_enabled:0

# Keyspace

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

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

------ FAST MEMORY TEST ------
*** Preparing to test memory region 7e5000 (2281472 bytes)
*** Preparing to test memory region 120d000 (270336 bytes)
*** Preparing to test memory region 7f3295c00000 (8388608 bytes)
*** Preparing to test memory region 7f329810a000 (8192 bytes)
*** Preparing to test memory region 7f329858e000 (4096 bytes)
*** Preparing to test memory region 7f3298bed000 (8192 bytes)
*** Preparing to test memory region 7f32991a1000 (16384 bytes)
*** Preparing to test memory region 7f32993bf000 (16384 bytes)
*** Preparing to test memory region 7f3299816000 (16384 bytes)
*** Preparing to test memory region 7f329a60c000 (73728 bytes)
*** Preparing to test memory region 7f329a627000 (4096 bytes)
.O.O.O.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.

------ DUMPING CODE AROUND EIP ------
Symbol: gsignal (base: 0x7f3298e2bb90)
Module: /lib64/libc.so.6 (base 0x7f3298df8000)
$ xxd -r -p /tmp/dump.hex /tmp/dump.bin
$ objdump --adjust-vma=0x7f3298e2bb90 -D -b binary -m i386:x86-64 /tmp/dump.bin
------
3374:M 22 Feb 2024 13:14:51.681 # dump of function (hexdump of 400 bytes):
5349c7c0ffffffff89fb41ba0800000031ff4881ec1001000064488b042528000000488984240801000031c04989e148b8ffffff7ffeffffff4c8984248800000048898424800000004c89842490000000488db424800000004c898424980000004c898424a00000004c89ca4c898424a80000004c898424b0000000b80e0000004c898424b80000004c898424c00000004c898424c80000004c898424d00000004c898424d80000004c898424e00000004c898424e80000004c898424f00000004c898424f80000000f05bf2700000089f80f054889c7b8ba0000000f054863f04863ff4863d3b8ea0000000f05483d00f0ffff77394189c041ba0800000031d24c89cebf02000000b80e0000000f05488b8c24080100006448330c25280000004489c075174881c4100100005bc3488b159a313700f7d8648902ebbce85ec10c00662e0f1f8400000000000f1f400085ff7807f7dfe965020000488b056e31370064c70016000000b8ffffffffc390900f1f440000662e0f1f84000000000048c7c00f0000000f050f1f8000000000
Function at 0x7f3298ef7e30 is __stack_chk_fail
linux rust redis redisjson
1个回答
0
投票

看来这个版本的RedisJSON需要最低Redis版本7.2:https://github.com/RedisJSON/RedisJSON/releases/tag/v2.6.4

崩溃本身似乎是因为 RedisJSON(或者更确切地说,它的依赖项)需要模块 API 中的这些函数:https://github.com/RedisLabsModules/redismodule-rs/blob/v2.0.7/src/context/命令.rs#L366-L367

例如,RedisModule_SetCommandInfo 仅在 Redis 7 上可用:https://github.com/redis/redis/pull/10108

© www.soinside.com 2019 - 2024. All rights reserved.