Skip to content

age_create_barbell_graph() crashes the backend (SIGSEGV) when node_label is left at its default #2519

Description

@NotHimmel

Describe the bug

Calling ag_catalog.age_create_barbell_graph() with only its first three arguments crashes the backend with a segmentation fault. node_label is declared name = NULL in the signature, so leaving it out is a supported call.

Because a backend segfault makes the postmaster reinitialize, every other session on the instance is disconnected as well, and the database briefly goes into recovery.

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

psql

What is the command that caused the error?

LOAD 'age';
SET search_path = ag_catalog, "$user", public;

SELECT create_graph('barbell_test');
SELECT age_create_barbell_graph('barbell_test', 5, 0);

Client:

server closed the connection unexpectedly
	This probably means the server terminated abnormally
	before or while processing the request.
connection to server was lost

Server log:

LOG:  client backend (PID 312566) was terminated by signal 11: Segmentation fault
LOG:  all server processes terminated; reinitializing

Passing NULL explicitly for node_label crashes the same way, even with the later arguments supplied:

SELECT age_create_barbell_graph('barbell_test', 5, 0, NULL, NULL, 'E');

What crashes and what does not:

call result
age_create_barbell_graph('g', 5, 0) SIGSEGV
age_create_barbell_graph('g', 5, 0, 'V') ERROR: edge label can not be NULL
age_create_barbell_graph('g', 5, 0, 'V', NULL, 'E') works
age_create_barbell_graph('g', 5, 0, NULL, NULL, 'E') SIGSEGV

So the crash happens whenever node_label is NULL, whether that comes from the declared default or from an explicit NULL.

Expected behavior

node_label has a default in the signature, so it should either fall back to the default vertex label or fail with a normal ERROR. No argument combination should be able to terminate the backend.

Environment:

  • Version: PostgreSQL 18.4 (built from source), Apache AGE master @ 8014174 (1.8.0)
  • The same code is present on release/PG18/1.7.0, so other branches are likely affected too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions