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 on invalid distance() query with index #2473

Closed
LiorKogan opened this issue Jul 16, 2022 · 2 comments · Fixed by #2475
Closed

Crash on invalid distance() query with index #2473

LiorKogan opened this issue Jul 16, 2022 · 2 comments · Fixed by #2475
Labels

Comments

@LiorKogan
Copy link
Member

LiorKogan commented Jul 16, 2022

RedisGraph 2.8.15

The following command sequence works correctly:

graph.delete q
graph.query q "CREATE (e:Employer {loc:point({latitude:40.4, longitude:30.3})})"
graph.query q "CREATE INDEX FOR (e:Employer) ON (e.loc)"
graph.query q "MATCH (e:Employer) WHERE distance(point({latitude:40.5, longitude: 30.4}), e.loc) < 20000 RETURN e"

The following command sequence outputs the expected error:

graph.delete q
graph.query q "CREATE (e:Employer {loc:point({latitude:40.4, longitude:30.3})})"
graph.query q "MATCH (e:Employer) WHERE distance(point({latitude:40.5, longitude: 30.4}, e.loc)) < 20000 RETURN e"

(error) Received 2 arguments to function 'point', expected at most 1

However, the following command sequence leads to a crash:

graph.delete q
graph.query q "CREATE (e:Employer {loc:point({latitude:40.4, longitude:30.3})})"
graph.query q "CREATE INDEX FOR (e:Employer) ON (e.loc)"
graph.query q "MATCH (e:Employer) WHERE distance(point({latitude:40.5, longitude: 30.4}, e.loc)) < 20000 RETURN e"
@LiorKogan LiorKogan added the bug label Jul 16, 2022
@gkorland
Copy link
Contributor

=== REDIS BUG REPORT START: Cut & paste starting from here ===
125822:M 17 Jul 2022 10:31:30.451 # === ASSERTION FAILED ===
125822:M 17 Jul 2022 10:31:30.451 # ==> /home/guy/workspace/RedisGraph/src/arithmetic/arithmetic_expression.c:280 'AR_EXP_IsOperation(root)' is not true

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

Backtrace:
/home/guy/workspace/RedisGraph/src/redisgraph.so(AR_EXP_ReduceToScalar+0x129)[0x7ffff4a23751]
/home/guy/workspace/RedisGraph/src/redisgraph.so(extractOriginAndRadius+0x226)[0x7ffff4b974da]
/home/guy/workspace/RedisGraph/src/redisgraph.so(isDistanceFilter+0x2b)[0x7ffff4b97668]
/home/guy/workspace/RedisGraph/src/redisgraph.so(+0x379086)[0x7ffff4b72086]
/home/guy/workspace/RedisGraph/src/redisgraph.so(_applicableFilter+0x7b)[0x7ffff4b722f2]
/home/guy/workspace/RedisGraph/src/redisgraph.so(_applicableFilters+0x64)[0x7ffff4b72453]
/home/guy/workspace/RedisGraph/src/redisgraph.so(reduce_scan_op+0x231)[0x7ffff4b72889]
/home/guy/workspace/RedisGraph/src/redisgraph.so(utilizeIndices+0xa5)[0x7ffff4b73222]
/home/guy/workspace/RedisGraph/src/redisgraph.so(optimizePlan+0x34)[0x7ffff4b59181]
/home/guy/workspace/RedisGraph/src/redisgraph.so(ExecutionPlan_PreparePlan+0xb9)[0x7ffff4acd7a7]
/home/guy/workspace/RedisGraph/src/redisgraph.so(+0x2b7767)[0x7ffff4ab0767]
/home/guy/workspace/RedisGraph/src/redisgraph.so(_query+0x1b9)[0x7ffff4ab0cbf]
/home/guy/workspace/RedisGraph/src/redisgraph.so(Graph_Query+0x21)[0x7ffff4ab0d53]
/home/guy/workspace/RedisGraph/src/redisgraph.so(+0x4f0c91)[0x7ffff4ce9c91]
/lib/x86_64-linux-gnu/libc.so.6(+0x94b43)[0x7ffff777eb43]
/lib/x86_64-linux-gnu/libc.so.6(+0x126a00)[0x7ffff7810a00]

@gkorland
Copy link
Contributor

=== REDIS BUG REPORT START: Cut & paste starting from here ===
9:M 17 Jul 2022 07:44:42.518 # Redis 6.2.7 crashed by signal: 11, si_code: 1
9:M 17 Jul 2022 07:44:42.518 # Accessing address: 0x1e
9:M 17 Jul 2022 07:44:42.518 # Crashed running the instruction at: 0x7f2da9cd44b7

------ STACK TRACE ------
EIP:
/opt/redis-stack/lib/redisgraph.so(AR_EXP_ReduceToScalar+0x77)[0x7f2da9cd44b7]

Backtrace:
/lib/x86_64-linux-gnu/libpthread.so.0(+0x14420)[0x7f2dad035420]
/opt/redis-stack/lib/redisgraph.so(AR_EXP_ReduceToScalar+0x77)[0x7f2da9cd44b7]
/opt/redis-stack/lib/redisgraph.so(extractOriginAndRadius+0x12c)[0x7f2da9cff08c]
/opt/redis-stack/lib/redisgraph.so(isDistanceFilter+0x13)[0x7f2da9cff223]
/opt/redis-stack/lib/redisgraph.so(+0x209a18)[0x7f2da9cfaa18]
/opt/redis-stack/lib/redisgraph.so(_applicableFilter+0x60)[0x7f2da9cfac80]
/opt/redis-stack/lib/redisgraph.so(_applicableFilters+0x5b)[0x7f2da9cfadab]
/opt/redis-stack/lib/redisgraph.so(reduce_scan_op+0xf9)[0x7f2da9cfaf19]
/opt/redis-stack/lib/redisgraph.so(utilizeIndices+0x74)[0x7f2da9cfb4d4]
/opt/redis-stack/lib/redisgraph.so(optimizePlan+0x1d)[0x7f2da9cfa77d]
/opt/redis-stack/lib/redisgraph.so(ExecutionPlan_PreparePlan+0x16)[0x7f2da9ce82a6]
/opt/redis-stack/lib/redisgraph.so(+0x1f118e)[0x7f2da9ce218e]
/opt/redis-stack/lib/redisgraph.so(+0x23868f)[0x7f2da9d2968f]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8609)[0x7f2dad029609]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x43)[0x7f2dacf4e133]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants