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

Crash due to untrue assertion AlgebraicExpression_DiagonalOperand #3058

Open
DominicWuest opened this issue Apr 23, 2023 · 1 comment · May be fixed by #3078
Open

Crash due to untrue assertion AlgebraicExpression_DiagonalOperand #3058

DominicWuest opened this issue Apr 23, 2023 · 1 comment · May be fixed by #3078
Assignees

Comments

@DominicWuest
Copy link

When running the following query:

MATCH ()-[*0]->(:A)--() RETURN 0

The RedisGraph instance crashed because of the assertion AlgebraicExpression_DiagonalOperand(ae_src, 0) being untrue.

I encountered this issue when testing queries against RedisGraph v2.12.0 compiled with address sanitization in a Docker container running alpine v.3.

Redis Bug Report
=== REDIS BUG REPORT START: Cut & paste starting from here ===
10:M 22 Apr 2023 23:11:11.967 # === ASSERTION FAILED ===
10:M 22 Apr 2023 23:11:11.967 # ==> /app/src/execution_plan/execution_plan_build/build_match_op_tree.c:74 'AlgebraicExpression_DiagonalOperand(ae_src, 0)' is not true

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

Backtrace:
redis-server *:6379(_serverAssert+0x8c)[0x5585c0cf5b8c]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(+0x673eff)[0x7fb872cf4eff]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(buildMatchOpTree+0x4b3)[0x7fb872cf4563]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(ExecutionPlanSegment_ConvertClause+0x9b)[0x7fb872cfbc5b]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(ExecutionPlan_PopulateExecutionPlan+0x1ad)[0x7fb872cf057d]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(+0x66fdc9)[0x7fb872cf0dc9]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(+0x66dffb)[0x7fb872ceeffb]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(NewExecutionPlan+0xa3)[0x7fb872cedcc3]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(ExecutionCtx_FromQuery+0x4c3)[0x7fb872cc4073]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(_query+0xdd)[0x7fb872cc088d]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(Graph_Query+0x19)[0x7fb872cc30e9]
/app/bin/linux-x64-debug-asan/src/redisgraph.so(+0x831d8a)[0x7fb872eb2d8a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7ea7)[0x7fb87ad69ea7]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7fb87ac87a2f]

------ INFO OUTPUT ------
# Server

redis_version:7.0.11

redis_git_sha1:00000000

redis_git_dirty:0

redis_build_id:5c712dc4cb9cfb70

redis_mode:standalone

os:Linux 6.2.10-arch1-1 x86_64

arch_bits:64

monotonic_clock:POSIX clock_gettime

multiplexing_api:epoll

atomicvar_api:c11-builtin

gcc_version:10.2.1

process_id:10

process_supervised:no

run_id:a57f6b5a03a7c96e0875531627dc832b4698675e

tcp_port:6379

server_time_usec:1682205071965643

uptime_in_seconds:17

uptime_in_days:0

hz:10

configured_hz:10

lru_clock:4483471

executable:/redis/redis-server

config_file:

io_threads_active:0



# Clients

connected_clients:1

cluster_connections:0

maxclients:10000

client_recent_max_input_buffer:0

client_recent_max_output_buffer:0

blocked_clients:1

tracking_clients:0

clients_in_timeout_table:0



# Memory

used_memory:1361760

used_memory_human:1.30M

used_memory_rss:37486592

used_memory_rss_human:35.75M

used_memory_peak:1361760

used_memory_peak_human:1.30M

used_memory_peak_perc:100.75%

used_memory_overhead:928888

used_memory_startup:928632

used_memory_dataset:432872

used_memory_dataset_perc:99.94%

allocator_allocated:1223792

allocator_active:1409024

allocator_resident:4825088

total_system_memory:8039120896

total_system_memory_human:7.49G

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

allocator_frag_bytes:185232

allocator_rss_ratio:3.42

allocator_rss_bytes:3416064

rss_overhead_ratio:7.77

rss_overhead_bytes:32661504

mem_fragmentation_ratio:40.36

mem_fragmentation_bytes:36557816

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:1682205054

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:1

total_commands_processed:2

instantaneous_ops_per_sec:0

total_net_input_bytes:188

total_net_output_bytes:93

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:2

keyspace_misses:1

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:2

total_writes_processed:1

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:6e394081bc4de55ca0fa8f2f233644864563f9e2

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

used_cpu_user:0.037020

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



# Modules

module:name=graph,ver=21200,api=1,filters=0,usedby=[],using=[],options=[]



# Commandstats

cmdstat_graph.QUERY:calls=2,usec=2104,usec_per_call=1052.00,rejected_calls=0,failed_calls=0



# Errorstats



# Latencystats

latency_percentiles_usec_graph.QUERY:p50=1990.655,p99=1990.655,p99.9=1990.655



# Cluster

cluster_enabled:0



# Keyspace

db0:keys=1,expires=0,avg_ttl=0


------ CLIENT LIST OUTPUT ------
id=6 addr=172.17.0.1:44272 laddr=172.17.0.2:6379 fd=8 name= age=0 idle=0 flags=b db=0 sub=0 psub=0 ssub=0 multi=-1 qbuf=0 qbuf-free=20474 argv-mem=83 multi-mem=0 rbs=16384 rbp=16384 obl=0 oll=0 omem=0 tot-mem=37747 events=r cmd=graph.QUERY user=default redir=-1 resp=2

------ MODULES INFO OUTPUT ------
# graph_executing commands

graph_command:GRAPH.QUERY CYPHER TIMEOUT_DEFAULT="30000" MATCH ()-[*0]->(:A)--() RETURN 0


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

------ FAST MEMORY TEST ------
10:M 22 Apr 2023 23:11:11.970 # main thread terminated
10:M 22 Apr 2023 23:11:11.970 # Bio thread for job type #0 terminated
10:M 22 Apr 2023 23:11:11.970 # Bio thread for job type #1 terminated
10:M 22 Apr 2023 23:11:11.970 # Bio thread for job type #2 terminated

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

Steps to reproduce

Run the following query and observe the database crashes:

MATCH ()-[*0]->(:A)--() RETURN 0

Expected behavior

The query should run successfully

Actual behavior

The database crashes, with the untrue assertion: AlgebraicExpression_DiagonalOperand(ae_src, 0).

@nafraf
Copy link
Contributor

nafraf commented Apr 24, 2023

EDIT: If address sanitization is used, the error is reproducible.

If address sanitization is not used, the crash is not reproducible in master branch:

127.0.0.1:6379> GRAPH.query g "MATCH ()-[*0]->(:A)--() RETURN 0"
1) 1) "0"
2) (empty array)
3) 1) "Cached execution: 0"
   2) "Query internal execution time: 0.374947 milliseconds"

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 a pull request may close this issue.

2 participants