Crash report

A module is involved, but it's my own doing. Version of Redis is 7.0, and I've tried both a local install and the Docker image with the same result. Basically, I have a need to have boost::geometry server-side on Redis, and I've been using C++14. When I run in release mode using CLion, the seg faults happen in my first pic below, and the second pic is the call stack. If I need to, I can share very similar code.

I've verified with cout statements that all of my save commands go through okay in release mode, so this is happening with something after that when Redis wraps up the save. When I run it with Valgrind with the module built in release mode, it saves the RDB just fine (sample output after crash report), and compiling with -Wall doesn't show anything too frightening. I am just dipping my toes back into C/C++, so I am very confused.

Redis [CRASH] Custom module works in debug but not release mode Redis [CRASH] Custom module works in debug but not release mode

=== REDIS BUG REPORT START: Cut & paste starting from here ===
29912:M 08 Jun 2022 19:40:39.338 # Redis 7.0.0 crashed by signal: 11, si_code: 2
29912:M 08 Jun 2022 19:40:39.338 # Accessing address: 0x7ffcb19a9a70
29912:M 08 Jun 2022 19:40:39.338 # Crashed running the instruction at: 0x7ffcb19a9a70

------ STACK TRACE ------
EIP:
[0x7ffcb19a9a70]

Backtrace:
/usr/lib64/libpthread.so.0(+0x118e0)[0x7f7fd75678e0]
[0x7ffcb19a9a70]

------ REGISTERS ------
29912:M 08 Jun 2022 19:40:39.338 # 
RAX:0000000000000001 RBX:00007ffcb19a8840
RCX:0000000000000002 RDX:0000000000000001
RDI:00007ffcb19a8720 RSI:0000000000000002
RBP:00007f7fd6c3a1e0 RSP:00007ffcb19a8708
R8 :00000000025bf500 R9 :00007ffcb19a86f0
R10:0000000000000030 R11:0000000000000003
R12:0000000000000002 R13:00007f7fd6c271a0
R14:0000000000000000 R15:0000000000000000
RIP:00007ffcb19a9a70 EFL:0000000000010206
CSGSFS:002b000000000033
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8717) -> 7ffffffeb19a8800
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8716) -> 00000000004d2b4b
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8715) -> 00007ffcb19a8840
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8714) -> 0000000000000000
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8713) -> 0000000000000002
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8712) -> 0000000000444ad3
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8711) -> 00007f7fffffffff
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8710) -> 0000000000000000
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870f) -> 0000000000000000
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870e) -> 0000000000000000
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870d) -> 00007f7fd6c3a1e0
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870c) -> 00007ffcb19a8840
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870b) -> 000000000000000c
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a870a) -> f7007f7fd6cd0000
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8709) -> 00007ffcb19a8840
29912:M 08 Jun 2022 19:40:39.338 # (00007ffcb19a8708) -> 000000000047824d

------ INFO OUTPUT ------
# Server
redis_version:7.0.0
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:fb73256ddd51d273
redis_mode:standalone
os:Linux 4.14.256-197.484.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:29912
process_supervised:no
run_id:fe1d4eb1301d9c15df4f95f9863c58cf939506c9
tcp_port:6379
server_time_usec:1654717238612018
uptime_in_seconds:10
uptime_in_days:0
hz:10
configured_hz:10
lru_clock:10550070
executable:/tmp/tmp.ZNd7dv6XXd/redis-server
config_file:/tmp/tmp.ZNd7dv6XXd/redis.conf
io_threads_active:0

# Clients
connected_clients:1
cluster_connections:0
maxclients:4064
client_recent_max_input_buffer:8
client_recent_max_output_buffer:0
blocked_clients:0
tracking_clients:0
clients_in_timeout_table:0

# Memory
used_memory:485603856
used_memory_human:463.11M
used_memory_rss:592535552
used_memory_rss_human:565.09M
used_memory_peak:485603856
used_memory_peak_human:463.11M
used_memory_peak_perc:100.00%
used_memory_overhead:608920
used_memory_startup:608624
used_memory_dataset:484994936
used_memory_dataset_perc:100.00%
allocator_allocated:485636544
allocator_active:502837248
allocator_resident:653000704
total_system_memory:73756090368
total_system_memory_human:68.69G
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:1.04
allocator_frag_bytes:17200704
allocator_rss_ratio:1.30
allocator_rss_bytes:150163456
rss_overhead_ratio:0.91
rss_overhead_bytes:-60465152
mem_fragmentation_ratio:1.22
mem_fragmentation_bytes:106958296
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.2.1
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:1654717228
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:9
total_commands_processed:8
instantaneous_ops_per_sec:0
total_net_input_bytes:738
total_net_output_bytes:14275
instantaneous_input_kbps:0.01
instantaneous_output_kbps:0.15
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
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:17
total_writes_processed:8
io_threaded_reads_processed:0
io_threaded_writes_processed:0
reply_buffer_shrinks:0
reply_buffer_expands:0

# Replication
role:master
connected_slaves:0
master_failover_state:no-failover
master_replid:c337ecfac082e7734ffe4557fc9944a85036d526
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.617492
used_cpu_user:8.918874
used_cpu_sys_children:0.000000
used_cpu_user_children:0.000000
used_cpu_sys_main_thread:0.419496
used_cpu_user_main_thread:4.422677

# Modules
module:name=RedisVect,ver=1,api=1,filters=0,usedby=[],using=[],options=[]

# Commandstats
cmdstat_CoreZones.print:calls=1,usec=472,usec_per_call=472.00,rejected_calls=0,failed_calls=0
cmdstat_RedisVect.setcorebndpoly:calls=1,usec=3,usec_per_call=3.00,rejected_calls=0,failed_calls=0
cmdstat_RedisVect.fromcsv:calls=1,usec=4047177,usec_per_call=4047177.00,rejected_calls=0,failed_calls=0
cmdstat_RedisVect.addchannel:calls=3,usec=78065,usec_per_call=26021.67,rejected_calls=0,failed_calls=0
cmdstat_RedisVect.setchanpolys:calls=1,usec=2698088,usec_per_call=2698088.00,rejected_calls=0,failed_calls=0
cmdstat_RedisVect.setchanbndpoly:calls=1,usec=17,usec_per_call=17.00,rejected_calls=0,failed_calls=0

# Errorstats

# Latencystats
latency_percentiles_usec_CoreZones.print:p50=473.087,p99=473.087,p99.9=473.087
latency_percentiles_usec_RedisVect.setcorebndpoly:p50=3.007,p99=3.007,p99.9=3.007
latency_percentiles_usec_RedisVect.fromcsv:p50=1002438.655,p99=1002438.655,p99.9=1002438.655
latency_percentiles_usec_RedisVect.addchannel:p50=15400.959,p99=54001.663,p99.9=54001.663
latency_percentiles_usec_RedisVect.setchanpolys:p50=1002438.655,p99=1002438.655,p99.9=1002438.655
latency_percentiles_usec_RedisVect.setchanbndpoly:p50=17.023,p99=17.023,p99.9=17.023

# Cluster
cluster_enabled:0

# Keyspace
db0:keys=2,expires=0,avg_ttl=0

------ CLIENT LIST OUTPUT ------
id=12 addr=127.0.0.1:53872 laddr=127.0.0.1:6379 fd=8 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=14 qbuf-free=20460 argv-mem=4 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=37644 events=r cmd=save user=default redir=-1 resp=2

------ CURRENT CLIENT INFO ------
id=12 addr=127.0.0.1:53872 laddr=127.0.0.1:6379 fd=8 name= age=0 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=14 qbuf-free=20460 argv-mem=4 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=37644 events=r cmd=save user=default redir=-1 resp=2
argv[0]: '"save"'

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

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

------ FAST MEMORY TEST ------
29912:M 08 Jun 2022 19:40:39.338 # Bio thread for job type #0 terminated
29912:M 08 Jun 2022 19:40:39.338 # Bio thread for job type #1 terminated
29912:M 08 Jun 2022 19:40:39.339 # Bio thread for job type #2 terminated
*** Preparing to test memory region 86f000 (2297856 bytes)
*** Preparing to test memory region 25bc000 (3760128 bytes)
*** Preparing to test memory region 7f7effc00000 (138547200 bytes)
*** Preparing to test memory region 7f7f0c600000 (60952576 bytes)
*** Preparing to test memory region 7f7f14000000 (135168 bytes)
*** Preparing to test memory region 7f7f18000000 (135168 bytes)
*** Preparing to test memory region 7f7f1c000000 (135168 bytes)
*** Preparing to test memory region 7f7f20000000 (37781504 bytes)
*** Preparing to test memory region 7f7f244fe000 (15728640 bytes)
*** Preparing to test memory region 7f7f265ff000 (18874368 bytes)
*** Preparing to test memory region 7f7f28000000 (135168 bytes)
*** Preparing to test memory region 7f7f2c000000 (135168 bytes)
*** Preparing to test memory region 7f7f30000000 (135168 bytes)
*** Preparing to test memory region 7f7f34000000 (135168 bytes)
*** Preparing to test memory region 7f7f38000000 (135168 bytes)
*** Preparing to test memory region 7f7f3c000000 (135168 bytes)
*** Preparing to test memory region 7f7f40000000 (135168 bytes)
*** Preparing to test memory region 7f7f441f9000 (6291456 bytes)
*** Preparing to test memory region 7f7f457fc000 (8388608 bytes)
*** Preparing to test memory region 7f7f463ff000 (18874368 bytes)
*** Preparing to test memory region 7f7f47600000 (8388608 bytes)
*** Preparing to test memory region 7f7f47e00000 (58744832 bytes)
*** Preparing to test memory region 7f7f4c000000 (135168 bytes)
*** Preparing to test memory region 7f7f50000000 (135168 bytes)
*** Preparing to test memory region 7f7f54000000 (135168 bytes)
*** Preparing to test memory region 7f7f58000000 (135168 bytes)
*** Preparing to test memory region 7f7f5c000000 (135168 bytes)
*** Preparing to test memory region 7f7f60000000 (135168 bytes)
*** Preparing to test memory region 7f7f64000000 (135168 bytes)
*** Preparing to test memory region 7f7f68000000 (135168 bytes)
*** Preparing to test memory region 7f7f6c000000 (135168 bytes)
*** Preparing to test memory region 7f7f70000000 (135168 bytes)
*** Preparing to test memory region 7f7f74000000 (135168 bytes)
*** Preparing to test memory region 7f7f78000000 (135168 bytes)
*** Preparing to test memory region 7f7f7c000000 (67244032 bytes)
*** Preparing to test memory region 7f7f84080000 (66719744 bytes)
*** Preparing to test memory region 7f7f8c000000 (135168 bytes)
*** Preparing to test memory region 7f7f90000000 (135168 bytes)
*** Preparing to test memory region 7f7f94000000 (135168 bytes)
*** Preparing to test memory region 7f7f98000000 (135168 bytes)
*** Preparing to test memory region 7f7f9c000000 (135168 bytes)
*** Preparing to test memory region 7f7fa0000000 (135168 bytes)
*** Preparing to test memory region 7f7fa4000000 (135168 bytes)
*** Preparing to test memory region 7f7fa8000000 (135168 bytes)
*** Preparing to test memory region 7f7fac07f000 (5767168 bytes)
*** Preparing to test memory region 7f7fac600000 (8388608 bytes)
*** Preparing to test memory region 7f7face00000 (12582912 bytes)
*** Preparing to test memory region 7f7fadb00000 (508559360 bytes)
*** Preparing to test memory region 7f7fcc07f000 (12058624 bytes)
*** Preparing to test memory region 7f7fccc00000 (8388608 bytes)
*** Preparing to test memory region 7f7fcd400000 (6291456 bytes)
*** Preparing to test memory region 7f7fcdbac000 (8388608 bytes)
*** Preparing to test memory region 7f7fce3ad000 (8388608 bytes)
*** Preparing to test memory region 7f7fcebae000 (8388608 bytes)
*** Preparing to test memory region 7f7fcf942000 (16384 bytes)
*** Preparing to test memory region 7f7fcfc30000 (4096 bytes)
*** Preparing to test memory region 7f7fd6800000 (8388608 bytes)
*** Preparing to test memory region 7f7fd7552000 (16384 bytes)
*** Preparing to test memory region 7f7fd7770000 (16384 bytes)
*** Preparing to test memory region 7f7fd80db000 (32768 bytes)
*** Preparing to test memory region 7f7fd80e5000 (4096 bytes)
.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.O.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.

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

Additional information

  1. OS is Amazon Linux 2
  2. I can't share the code at this point, but I could work up an equivalent example if needed
  3. Example chunk of Valgrind output below
==17404== Conditional jump or move depends on uninitialised value(s)
==17404==    at 0x4D2B3F: rdbSaveModulesAux (module.c:6659)
==17404==    by 0x47877B: rdbSaveRio (rdb.c:1347)
==17404==    by 0x47B1A2: rdbSave (rdb.c:1421)
==17404==    by 0x47D099: saveCommand (rdb.c:3481)
==17404==    by 0x449A1E: call (server.c:3265)
==17404==    by 0x44C6AA: processCommand (server.c:3906)
==17404==    by 0x46017B: processCommandAndResetClient (networking.c:2438)
==17404==    by 0x462799: processInputBuffer (networking.c:2542)
==17404==    by 0x465720: readQueryFromClient (networking.c:2673)
==17404==    by 0x4F4F74: callHandler (connhelpers.h:79)
==17404==    by 0x4F4F74: connSocketEventHandler (connection.c:310)
==17404==    by 0x44257C: aeProcessEvents (ae.c:436)
==17404==    by 0x4428F7: aeMain (ae.c:496)

Comment From: herter4171

Figured it out. In my use of RedisModule_CreateDataType, I had a non-pointer RedisModuleTypeMethods passed in via &, so apparently it was going away.