Skip to content

Server crashes when trying to execute SELECT * FROM cypher(...) AS (result agtype); #1398

Closed

Description

@saygoodbyye

Describe the bug
Server crashes when executing the following SQL-script

How are you accessing AGE (Command line, driver, etc.)?
Accessing AGE through command line.

What data setup do we need to do?
Apache AGE (master branch) with PostgreSQL (REL_15_STABLE).

What is the necessary configuration info needed?
My PostgreSQL configuration:

./configure CFLAGS=" -Og" --enable-tap-tests --enable-debug --enable-cassert

What is the command that caused the error?

CREATE EXTENSION age;
SET search_path TO ag_catalog;
SELECT create_graph('cypher_delete');
SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v)$$) AS (a agtype);
SELECT * FROM cypher('cypher_delete', $$CREATE (n:v)-[:e]->(:v)$$) AS (a agtype);
SELECT * FROM cypher('cypher_delete', $$MATCH(n)-[e]->(m) SET e.i = 1 DETACH DELETE n RETURN e$$) AS (a agtype);
SELECT * FROM cypher('cypher_delete', $$ MATCH (n) RETURN vertex_stats(n) $$) AS (result agtype);

backtrace:

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007f3656242866 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007f36562268b7 in __GI_abort () at ./stdlib/abort.c:79
#5  0x0000558ed8bd9249 in ExceptionalCondition (conditionName=conditionName@entry=0x7f364cf02173 "found", errorType=errorType@entry=0x7f364cf011d7 "FailedAssertion", 
    fileName=fileName@entry=0x7f364cf09fc0 "src/backend/utils/adt/age_global_graph.c", lineNumber=lineNumber@entry=358) at assert.c:69
#6  0x00007f364cef6ee7 in insert_vertex_edge (ggctx=ggctx@entry=0x558ed9002f18, start_vertex_id=<optimized out>, start_vertex_id@entry=844424930131971, end_vertex_id=<optimized out>, 
    end_vertex_id@entry=844424930131972, edge_id=edge_id@entry=1125899906842626) at src/backend/utils/adt/age_global_graph.c:358
#7  0x00007f364cef70a6 in load_edge_hashtable (ggctx=ggctx@entry=0x558ed9002f18) at src/backend/utils/adt/age_global_graph.c:581
#8  0x00007f364cef725e in load_GRAPH_global_hashtables (ggctx=ggctx@entry=0x558ed9002f18) at src/backend/utils/adt/age_global_graph.c:486
#9  0x00007f364cef75d4 in manage_GRAPH_global_contexts (graph_name=graph_name@entry=0x558ed9058498 "cypher_delete", graph_oid=16970) at src/backend/utils/adt/age_global_graph.c:786
#10 0x00007f364cef78bf in age_vertex_stats (fcinfo=<optimized out>) at src/backend/utils/adt/age_global_graph.c:1098
#11 0x0000558ed88fd26d in ExecInterpExpr (state=0x558ed916e640, econtext=0x558ed916d768, isnull=0x7ffcefcc7327) at execExprInterp.c:727
#12 0x0000558ed88fa003 in ExecInterpExprStillValid (state=0x558ed916e640, econtext=0x558ed916d768, isNull=0x7ffcefcc7327) at execExprInterp.c:1826
#13 0x0000558ed89388e0 in ExecEvalExprSwitchContext (state=<optimized out>, econtext=<optimized out>, isNull=<optimized out>) at ../../../src/include/executor/executor.h:344
#14 0x0000558ed8938927 in ExecProject (projInfo=0x558ed916e638) at ../../../src/include/executor/executor.h:378
#15 0x0000558ed8938ae0 in ExecResult (pstate=<optimized out>) at nodeResult.c:136
#16 0x0000558ed89099fc in ExecProcNodeFirst (node=0x558ed916d650) at execProcnode.c:464
#17 0x0000558ed89017a5 in ExecProcNode (node=node@entry=0x558ed916d650) at ../../../src/include/executor/executor.h:262
#18 0x0000558ed8901835 in ExecutePlan (estate=estate@entry=0x558ed916d3e0, planstate=0x558ed916d650, use_parallel_mode=<optimized out>, operation=operation@entry=CMD_SELECT, 
    sendTuples=sendTuples@entry=true, numberTuples=numberTuples@entry=0, direction=ForwardScanDirection, dest=0x558ed917a5c0, execute_once=true) at execMain.c:1636
#19 0x0000558ed89025f4 in standard_ExecutorRun (queryDesc=0x558ed905c0a0, direction=ForwardScanDirection, count=0, execute_once=true) at execMain.c:363
#20 0x0000558ed8902724 in ExecutorRun (queryDesc=queryDesc@entry=0x558ed905c0a0, direction=direction@entry=ForwardScanDirection, count=count@entry=0, execute_once=<optimized out>)
    at execMain.c:307
#21 0x0000558ed8aaa0c6 in PortalRunSelect (portal=portal@entry=0x558ed8fe99b0, forward=forward@entry=true, count=0, count@entry=9223372036854775807, dest=dest@entry=0x558ed917a5c0)
    at pquery.c:924
#22 0x0000558ed8aab948 in PortalRun (portal=portal@entry=0x558ed8fe99b0, count=count@entry=9223372036854775807, isTopLevel=isTopLevel@entry=true, run_once=run_once@entry=true, 
    dest=dest@entry=0x558ed917a5c0, altdest=altdest@entry=0x558ed917a5c0, qc=0x7ffcefcc7650) at pquery.c:768
#23 0x0000558ed8aa7ad4 in exec_simple_query (
    query_string=query_string@entry=0x558ed8f7e110 "SELECT * FROM cypher('cypher_delete', $$ MATCH (n) RETURN vertex_stats(n) $$) AS (result agtype);") at postgres.c:1250
#24 0x0000558ed8aa9938 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#25 0x0000558ed8a0e915 in BackendRun (port=port@entry=0x558ed8f9f130) at postmaster.c:4514
#26 0x0000558ed8a10925 in BackendStartup (port=port@entry=0x558ed8f9f130) at postmaster.c:4242
#27 0x0000558ed8a10b5e in ServerLoop () at postmaster.c:1809
#28 0x0000558ed8a12133 in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x558ed8f785f0) at postmaster.c:1481
#29 0x0000558ed895ee9b in main (argc=3, argv=0x558ed8f785f0) at main.c:202

Expected behavior
Expected ERROR to be shown or sql query to be succesfully executed

Best regards,
Egor Chindyaskin
Postgres Professional: http://postgrespro.com/

Activity

  1. added
    bug
    on Nov 14, 2023
  2. self-assigned this
    on Nov 14, 2023
  3. rafsun42 commented on Nov 14, 2023

    @rafsun42
    Member

    @saygoodbyye Thank you for reporting this issue. It is being looked into.

  4. added a commit that references this issue on Nov 21, 2023
  5. added a commit that references this issue on Nov 21, 2023
  6. rafsun42 commented on Nov 22, 2023

    @rafsun42
    Member

    @saygoodbyye Thanks for the wait. A patch has been applied related to this issue. Let us know if that resolves it.

  7. added 4 commits that reference this issue on Nov 22, 2023
  8. saygoodbyye commented on Nov 22, 2023

    @saygoodbyye
    Author

    @rafsun42 Issue doesn't reproduce, closing this issue. Thank you!

  9. added 4 commits that reference this issue on Nov 28, 2023
  10. added a commit that references this issue on Dec 13, 2023
  11. added a commit that references this issue on Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions