golang-neo4j-bolt-driver icon indicating copy to clipboard operation
golang-neo4j-bolt-driver copied to clipboard

No error-handling when connecting to non-responding DB

Open tkandal opened this issue 8 years ago • 5 comments

Hello, Sir!

Not sure if you, Sir, have the same attitude to error-handling, but in my opinion the driver should handle errors a little better when trying to connect to a non- responding Neo4J instance. ... panic: runtime error: invalid memory address or nil pointer dereference panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x7a pc=0x69a96] ...

What are your opinion regarding this issue?

tkandal avatar Feb 17 '17 12:02 tkandal

@tkandal - Sorry for the late response, I try to be as available as possible, but... you know, life :-)

I am absolutely of the opinion that this should be handled better by the driver. 👍

I'll try to take a look into this soon.

johnnadratowski avatar Feb 22 '17 18:02 johnnadratowski

Thank You, Sir!

No problem at all :)

I appreciate very much this driver and the work gone into it. I see many uses for it in my ongoing projects, and I plan to convert my colleagues from NodeJS to Go for REST-services backed by various databases and Neo4J. :)

tkandal avatar Feb 22 '17 20:02 tkandal

That's great to hear. I actually did this as a challenge and do not "eat my own dogfood" so there are probably some things I missed, such as this.

On Feb 22, 2017 3:15 PM, "Trond Kandal" [email protected] wrote:

Thank You, Sir!

No problem at all :)

I appreciate very much this driver and the work gone into it. I see many uses for it in my ongoing projects, and I plan to convert my colleagues from NodeJS to Go for REST-services backed by various databases and Neo4J. :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/johnnadratowski/golang-neo4j-bolt-driver/issues/26#issuecomment-281789318, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDWa0O-jLidHNfJ_8X_fXCLSr8sPsvBks5rfJdLgaJpZM4MENmP .

johnnadratowski avatar Feb 27 '17 14:02 johnnadratowski

any pointers on how this can be improved? I'm happy to look at making a PR

eastlondoner avatar Aug 07 '18 07:08 eastlondoner

The issue is that in conn.go on line 282, createConn returns a Conn and error. Both values can be nil. This becomes an issue on line 390 when c.conn.Close is ran on a nil value. A nil error check can be done before to prevent a segfault from occurring.

I made a modification to fix it, but need to add a unit test for it. After that I can do a PR.

alexbeltran avatar Sep 25 '18 00:09 alexbeltran