Neo4jBolt.jl icon indicating copy to clipboard operation
Neo4jBolt.jl copied to clipboard

Segmentation fault

Open keorn opened this issue 4 years ago • 6 comments

Actually I realised why I could not use this package before. I intermittently get segmentation fault:

_jl_invoke at /buildworker/worker/package_linux64/build/src/gf.c:2135 [inlined]
jl_apply_generic at /buildworker/worker/package_linux64/build/src/gf.c:2305
unknown function (ip: 0x401931)
unknown function (ip: 0x401533)
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4015d4)
Allocations: 45252668 (Pool: 45245323; Big: 7345); GC: 34
[1]    16489 segmentation fault (core dumped)

Seems like it happens when writing to socket at src/julia_bolt/JuliaBolt.jl:417

keorn avatar May 22 '20 11:05 keorn

FYI, PlantingSpace has put a $500 bounty on resolving of this issue: https://gitlab.com/plantingspace/tasks/-/issues/12

keorn avatar Feb 17 '21 08:02 keorn

Hi! I thought it would be a fun project for the weekend (and maybe profitable!) to try solving this issue and also learn some Julia (familiar with neo4j, python).

I tried running the code from master, but I hit #7 (solved, I think, in #8 ).

Then started a Neo4J container, and tried the following code:

using Neo4jBolt

driver = Neo4jBoltDriver("bolt://localhost:7687", auth=("neo4j", "s3cr3t"))

for i in range(0, length=1000)
    session(driver) do sess
        result = run(sess, "UNWIND(RANGE(1, 10)) AS z RETURN z")
        for record in result
            println(record["z"])
        end
    end

It took a couple minutes (creating new sessions is probably taking a toll) worked fine.

Tried then using transactions with the same session.

using Neo4jBolt

driver = Neo4jBoltDriver("bolt://localhost:7687", auth=("neo4j", "s3cr3t"))


session(driver) do sess
    begin_transaction(sess) do tx
        for i in range(0, length=1000)
            result = run(sess, "UNWIND(RANGE(1, 10)) AS z RETURN z")
            for record in result
                println(record["z"])
            end
        end
    end
end

No segmentation fault. Maybe it needs to be executed in parallel?

kinow avatar Nov 06 '21 10:11 kinow

Hey, thanks for having a look and sorry you were not able to reproduce. Yes, it was likely happening for parallelized code. Will test with newer version of Julia and see if it can be reproduced and under what conditions.

keorn avatar Nov 06 '21 20:11 keorn

Thanks @keorn . In case that happens, my env:

kinow@ranma:~$ julia -v
julia version 1.4.1
kinow@ranma:~$ uname -a
Linux ranma 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Used Docker + Neo4J, with JVM 11 (openJDK) and Neo4j 4.3.6.

Thanks!

kinow avatar Nov 06 '21 20:11 kinow

Thank you @kinow for working on this. Sorry I have not dedicated any time to this repository in a while.

virtualgraham avatar Nov 06 '21 22:11 virtualgraham

Not a problem @virtualgraham, and thanks for creating & sharing the code :-) . If you have some spare time later to review #8. I'm using that branch to use Neo4jBolt with Neo4j 4.3.

kinow avatar Nov 06 '21 23:11 kinow