Skip to content

Server crashes when trying to execute SELECT * FROM agtype(null); #1303

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 (PG15 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 * FROM agtype(null);

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  0x00007f6038a42866 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007f6038a268b7 in __GI_abort () at ./stdlib/abort.c:79
#5  0x000055c450cd4e41 in ExceptionalCondition (conditionName=conditionName@entry=0x7f602f7ce463 "HeapTupleIsValid(proctup)", 
    errorType=errorType@entry=0x7f602f7cc1d7 "FailedAssertion", fileName=fileName@entry=0x7f602f7ce428 "src/backend/utils/ag_func.c", 
    lineNumber=lineNumber@entry=49) at assert.c:69
#6  0x00007f602f7c6dba in is_oid_ag_func (func_oid=<optimized out>, func_name=func_name@entry=0x7f602f7ccd9c "cypher") at src/backend/utils/ag_func.c:49
#7  0x00007f602f7949ba in is_func_cypher (funcexpr=<optimized out>) at src/backend/parser/cypher_analyze.c:329
#8  0x00007f602f7949f4 in is_rte_cypher (rte=<optimized out>) at src/backend/parser/cypher_analyze.c:305
#9  0x00007f602f794a76 in convert_cypher_walker (node=node@entry=0x55c451a1b1f8, pstate=pstate@entry=0x55c451a1a9b8) at src/backend/parser/cypher_analyze.c:140
#10 0x000055c450a72532 in range_table_entry_walker (rte=0x55c451a1b1f8, walker=walker@entry=0x7f602f7949ff <convert_cypher_walker>, 
    context=context@entry=0x55c451a1a9b8, flags=flags@entry=21) at nodeFuncs.c:2526
#11 0x000055c450a7267f in range_table_walker (rtable=0x55c451a1b6d0, walker=walker@entry=0x7f602f7949ff <convert_cypher_walker>, 
    context=context@entry=0x55c451a1a9b8, flags=flags@entry=21) at nodeFuncs.c:2505
#12 0x000055c450a72871 in query_tree_walker (query=query@entry=0x55c451a1aad0, walker=walker@entry=0x7f602f7949ff <convert_cypher_walker>, 
    context=context@entry=0x55c451a1a9b8, flags=flags@entry=21) at nodeFuncs.c:2482
#13 0x00007f602f794bbb in convert_cypher_walker (node=node@entry=0x55c451a1aad0, pstate=pstate@entry=0x55c451a1a9b8) at src/backend/parser/cypher_analyze.c:234
#14 0x00007f602f794df4 in post_parse_analyze (pstate=0x55c451a1a9b8, query=0x55c451a1aad0, jstate=<optimized out>) at src/backend/parser/cypher_analyze.c:104
#15 0x000055c45090d1d8 in parse_analyze_fixedparams (parseTree=parseTree@entry=0x55c451a1a928, 
    sourceText=sourceText@entry=0x55c451a19970 "SELECT * FROM agtype(null);", paramTypes=paramTypes@entry=0x0, numParams=numParams@entry=0, 
    queryEnv=queryEnv@entry=0x0) at analyze.c:129
#16 0x000055c450ba3220 in pg_analyze_and_rewrite_fixedparams (parsetree=parsetree@entry=0x55c451a1a928, 
    query_string=query_string@entry=0x55c451a19970 "SELECT * FROM agtype(null);", paramTypes=paramTypes@entry=0x0, numParams=numParams@entry=0, 
    queryEnv=queryEnv@entry=0x0) at postgres.c:657
#17 0x000055c450ba38ee in exec_simple_query (query_string=query_string@entry=0x55c451a19970 "SELECT * FROM agtype(null);") at postgres.c:1166
#18 0x000055c450ba5851 in PostgresMain (dbname=<optimized out>, username=<optimized out>) at postgres.c:4598
#19 0x000055c450b0a832 in BackendRun (port=port@entry=0x55c451a3e100) at postmaster.c:4514
#20 0x000055c450b0c842 in BackendStartup (port=port@entry=0x55c451a3e100) at postmaster.c:4242
#21 0x000055c450b0ca7b in ServerLoop () at postmaster.c:1809
#22 0x000055c450b0e050 in PostmasterMain (argc=argc@entry=3, argv=argv@entry=0x55c451a10df0) at postmaster.c:1481
#23 0x000055c450a5adb8 in main (argc=3, argv=0x55c451a10df0) at main.c:202

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

Also reproduces on AGE master branch

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

Activity

  1. added
    bug
    on Oct 26, 2023
  2. jrgemignani commented on Oct 26, 2023

    @jrgemignani
    Contributor

    @theaniketraj Please stop spamming ChatGPT for issues.

  3. Zainab-Saad commented on Oct 26, 2023

    @Zainab-Saad
    Contributor

    This issue exists for some other scenarios too like this one

    agedb=# SELECT * FROM text(4);
     text 
    ------
     4
    (1 row)
    agedb=# LOAD 'age'; SET search_path to ag_catalog;
    LOAD
    SET
    agedb=# SELECT * FROM text(4);
    server closed the connection unexpectedly
    	This probably means the server terminated abnormally
    	before or while processing the request.
    The connection to the server was lost. Attempting reset: Failed.
    The connection to the server was lost. Attempting reset: Failed.
    !?> 
    

    This seems related to #1124
    I am working on this.

  4. jrgemignani commented on Oct 27, 2023

    @jrgemignani
    Contributor

    @saygoodbyye The fix for this has been merged into the master branch. Please check that it fixes your issue. If it does, please consider closing this issue.

  5. saygoodbyye commented on Oct 30, 2023

    @saygoodbyye
    Author

    Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions