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

MERGE followed by SET causes segfault #235

Closed
bravius opened this issue Jun 20, 2022 · 7 comments
Closed

MERGE followed by SET causes segfault #235

bravius opened this issue Jun 20, 2022 · 7 comments
Labels
bug Something isn't working

Comments

@bravius
Copy link

bravius commented Jun 20, 2022

Describe the bug

MERGE followed by SET causes server process segfault.

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

Bundled Node 'pg-age' driver.

What data setup do we need to do?

...
SELECT create_graph('test');
SELECT create_vlabel('test', 'node');
SELECT * FROM cypher('test', $$ CREATE (n:node {name: 'Jason'}) RETURN n $$) AS (n agtype);
...

What is the necessary configuration info needed?

None.

What is the command that caused the error?

SELECT * FROM cypher('test', $$ MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa' RETURN n $$) AS (n agtype);

NOTE: If the node exists, the server process crashes. However, if the node does not exist, the MERGE query completes successfully.

log dump

LOG:  server process (PID 4853) was terminated by signal 11: Segmentation fault

DETAIL:  Failed process was running: SELECT * FROM cypher('test', $$ MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa' RETURN n $$) AS (n agtype)

LOG:  terminating any other active server processes

WARNING:  terminating connection because of crash of another server process

DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.

HINT:  In a moment you should be able to reconnect to the database and repeat your command.

LOG:  all server processes terminated; reinitializing

LOG:  database system was interrupted; last known up at 2022-06-20 20:15:58 UTC

FATAL:  the database system is in recovery mode

LOG:  database system was not properly shut down; automatic recovery in progress

LOG:  redo starts at 0/521B0A0

LOG:  invalid record length at 0/526E288: wanted 24, got 0

LOG:  redo done at 0/526E250

LOG:  last completed transaction was at log time 2022-06-20 20:16:12.938992+00

LOG:  database system is ready to accept connections

Expected behavior

Execute cypher query with no crashy crashy.

Environment (please complete the following information):

  • postgresql with AGE extension running in a Docker container, on Windows 10 and WSL2
  • compiled AGE extension from master

Additional context

None.

@bravius bravius added the bug Something isn't working label Jun 20, 2022
@jrgemignani
Copy link
Contributor

Was able to reproduce the bug. Will look into a fix.

@pdpotter
Copy link
Contributor

Could this be related to #232 (comment), where the return value differs depending on whether a node exists before executing a MERGE?

@jrgemignani
Copy link
Contributor

Not sure, this appears to be specifically related to SET

@jrgemignani
Copy link
Contributor

A patch is currently in review to correct this issue.

@jrgemignani
Copy link
Contributor

Could this be related to #232 (comment), where the return value differs depending on whether a node exists before executing a MERGE?

This might address that issue. But, #232 is lacking clears examples to know for sure.

jrgemignani added a commit that referenced this issue Jul 1, 2022
Fixed github issue #235 for when MERGE and SET were used together.

FX: MERGE (n:node {name: 'Jason'}) SET n.name = 'Lisa' RETURN n

The issue is that the above command would cause a crash when the
target of the MERGE command existed. Meaning, it found a matching
tuple to return to the SET command.

The tuple generated for that particular case was not being sent up
to the SET command correctly, this was fixed.

Added a regression test.
@jrgemignani
Copy link
Contributor

This is now fixed in the master branch. It also fixes #232.

@bravius
Copy link
Author

bravius commented Jul 4, 2022

Resolved, thank you.

@bravius bravius closed this as completed Jul 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants