florinpatrascu / bolt_sips

Neo4j driver for Elixir
Apache License 2.0
258 stars 49 forks source link

using bolt_sips before db_connection v2 #52

Closed chungwong closed 5 years ago

chungwong commented 5 years ago

as ecto v2 requries db_connection: ~> 1.1, what commit should I use to avoid upgrading ecto to v3? I am using bolt_sips 0.4.12 and experience an error in production. Neo4j worked for a few hours and threw

ERROR [o.n.b.t.SocketTransportHandler] Fatal error occurred when handling a client connection: unable to create new native thread unable to create new native thread java.lang.OutOfMemoryError: unable to create new native thread

I am wondering if the latest commits would fix this problem.

florinpatrascu commented 5 years ago

you can use {:bolt_sips, "~> 0.4.12"}, from Hex.pm, if you are using db_connection 1.x.

Regarding the error, that's not one thrown by the Elixir driver; it is a Java exception, as you most probably realized by now, but I am just clarifying this for the users here not familiar with Java (if any?! ;)

chungwong commented 5 years ago

I am already using {:bolt_sips, "~> 0.4.12"} and I believe it is the same issue as https://github.com/florinpatrascu/bolt_sips/issues/41

For each Bolt.Sips.query, it opens a port and never close it. And although I can be wrong, each port on the client is holding a thread on the server as well.

I was monitoring the number of threads neo4j created. With 0.4.12 ps -Tp neo4j_process_id | wc the number of threads increase to ~4.9k because each Bolt.Sips.query would never release the port/thread.

After using commit https://github.com/florinpatrascu/bolt_sips/commit/e80616fc785d7a8e0a5e42381008d8ee27f07e0e, ps -Tp neo4j_process_id | wc remains constant

florinpatrascu commented 5 years ago

Sorry, I meant the -rc version: {:bolt_sips, "~> 1.0.0-rc2"} At the time of that issue, the master was following the dev branch of db_connection 2. The current bol_sipe release candidate is using the rc version of DBConnection. HTH

chungwong commented 5 years ago

using {:bolt_sips, "~> 1.0.0-rc2"} requires upgrading Ecto to V3

Failed to use "db_connection" because
  bolt_sips (version 1.0.0-rc2) requires ~> 2.0.0-rc.0
  ecto (version 2.2.10) requires ~> 1.1

For people like myself uses bolt_sips and cannot upgrade to Ecto 3 at this moment, it seems 1.0.0-rc2 is not an option but https://github.com/florinpatrascu/bolt_sips/commit/e80616fc785d7a8e0a5e42381008d8ee27f07e0e

florinpatrascu commented 5 years ago

Sorry :/

florinpatrascu commented 5 years ago

Is that commit workig, in your case?

chungwong commented 5 years ago

It is working, at least in my use case. Didn't see any error caused by db_connection. Thanks :)

florinpatrascu commented 5 years ago

Cool, thank you.