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

"where is not null" causes segmentation fault #2092

Open
dberardo-com opened this issue Sep 8, 2024 · 4 comments
Open

"where is not null" causes segmentation fault #2092

dberardo-com opened this issue Sep 8, 2024 · 4 comments
Labels
bug Something isn't working override-stale To keep issues/PRs untouched from stale action

Comments

@dberardo-com
Copy link

"where is not null" statement in this query causes postgres to crash with the following error: "server process (PID 327) was terminated by signal 11: Segmentation fault"

SELECT * FROM cypher('access_control_graph', $$
    MATCH direct_group= (u:Operator {name: 'Admin'})-[:BELONGS_TO*]->(nop:Group {_type: 'NOP'})-[:PARENT_OF*]->(g2:Group)
    OPTIONAL MATCH plants=(nop)-[:RESPONSIBLE_FOR*]->(inp:Group {_type: 'PLANT'})  // subgroups
    OPTIONAL MATCH direct_assets=(nop)-[:HAS_PERMISSION*]->(r:Resource {_type: 'ASSET'}) 
    OPTIONAL MATCH indirect_assets=(inp)-[:HAS_PERMISSION*]->(r1:Resource {_type: 'ASSET'})
    where inp IS NOT NULL
    
    RETURN direct_group, 
        plants
        ,direct_assets
      //  ,indirect_assets
$$) AS (direct_group agtype, 
plants agtype 
,direct_assets agtype
--,indirect_assets agtype
);
@dberardo-com dberardo-com added the bug Something isn't working label Sep 8, 2024
@MuhammadTahaNaveed
Copy link
Member

@dberardo-com Can you please share the following;

  • AGE version
  • Postgres version
  • Data setup we need to reproduce this bug

@dberardo-com
Copy link
Author

dberardo-com commented Sep 10, 2024

i have been using the latest official docker image of age

as for the data:

SELECT drop_graph('access_control_graph',true) ;
SELECT create_graph('access_control_graph') ;


SELECT * FROM cypher('access_control_graph', $$

    MERGE (u0:Operator {name: 'Admin'})
    MERGE (u1:Operator {name: 'Operator1'})
    MERGE (u2:Operator {name: 'Operator2'})

    MERGE (g0:Group {name: 'amministratori', _type: 'NOP', role: 'ADMIN'})
    MERGE (g1:Group {name: 'supporto', _type: 'NOP'})
    MERGE (g2:Group {name: 'manutenzione_acqua', _type: 'NOP'})
    MERGE (g3:Group {name: 'manutenzione_energia', _type: 'NOP'})
    
    MERGE (g4:Group {name: 'acqua', _type: 'PLANT'})
    MERGE (g5:Group {name: 'energia', _type: 'PLANT'})

    MERGE (r1:Resource {name: 'pompa1', _type: 'ASSET'})
    MERGE (r2:Resource {name: 'pompa2', _type: 'ASSET'})
    MERGE (r3:Resource {name: 'em1', _type: 'ASSET'})
    MERGE (r4:Resource {name: 'em2', _type: 'ASSET'})
    MERGE (r5:Resource {name: 'em3', _type: 'ASSET'})

    CREATE (g0)-[:PARENT_OF]->(g1)
    CREATE (g0)-[:PARENT_OF]->(g2)
    CREATE (g0)-[:PARENT_OF]->(g3)

    CREATE (g1)-[:RESPONSIBLE_FOR]->(g4)
    CREATE (g1)-[:RESPONSIBLE_FOR]->(g5)
    CREATE (g2)-[:RESPONSIBLE_FOR]->(g4)
    CREATE (g3)-[:RESPONSIBLE_FOR]->(g5)

    CREATE (g4)-[:HAS_PERMISSION {read: true, write: true}]->(r1)
    CREATE (g4)-[:HAS_PERMISSION {read: true, write: true}]->(r2)
    CREATE (g5)-[:HAS_PERMISSION {read: true, write: true}]->(r3)
    CREATE (g5)-[:HAS_PERMISSION {read: true, write: true}]->(r4)
    CREATE (g5)-[:HAS_PERMISSION {read: true, write: true}]->(r5)

    CREATE (u0)-[:BELONGS_TO]->(g0)
    CREATE (u1)-[:BELONGS_TO]->(g1)
    CREATE (u2)-[:BELONGS_TO]->(g2)

    // CREATE (g3)-[:DENIED]->(g4)
    // CREATE (g3)-[:DENIED]->(r2)

$$) AS (path agtype);


SELECT *
FROM cypher('access_control_graph', $$
  MATCH (n)-[r]->(m)
  RETURN n, r, m
$$) AS (n agtype, r agtype, m agtype);


---

SELECT * FROM cypher('access_control_graph', $$
    MATCH direct_group= (u:Operator {name: 'Operator1'})-[:BELONGS_TO*]->(nop:Group {_type: 'NOP'}) //-[:PARENT_OF*]->(g2:Group)
    OPTIONAL MATCH plants=(nop)-[:RESPONSIBLE_FOR*]->(inp:Group {_type: 'PLANT'})  // subgroups
    OPTIONAL MATCH direct_assets=(nop)-[:HAS_PERMISSION*]->(r:Resource {_type: 'ASSET'}) 
    OPTIONAL MATCH indirect_assets=(inp)-[:HAS_PERMISSION*]->(r1:Resource {_type: 'ASSET'})
    
    RETURN direct_group
        ,plants
        ,direct_assets
        ,indirect_assets
$$) AS (
    direct_group agtype
    ,plants agtype 
    ,direct_assets agtype
    ,indirect_assets agtype
);

the last query should give you error if you use the one i have posted above instead. let me know i you can reproduce

@MuhammadTahaNaveed
Copy link
Member

@dberardo-com I was able to reproduce the bug. We will look into it and update you as soon as we have a fix for it.

Copy link

This issue is stale because it has been open 60 days with no activity. Remove "Abondoned" label or comment or this will be closed in 14 days.

@github-actions github-actions bot added the Stale Stale issues/PRs label Nov 10, 2024
@MuhammadTahaNaveed MuhammadTahaNaveed added override-stale To keep issues/PRs untouched from stale action and removed Stale Stale issues/PRs labels Nov 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working override-stale To keep issues/PRs untouched from stale action
Projects
None yet
Development

No branches or pull requests

2 participants