florinpatrascu / bolt_sips

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

Bolt.Sips.conn returns bare :error #58

Closed Tomboyo closed 5 years ago

Tomboyo commented 5 years ago

Ahoy!

I'm able to use Bolt.Sips.conn in my test cases and interactively in iex, but an escript I've compiled is misbehaving. I'm sure this is something wrong with my configuration, but Bolt.Sips.conn returns a bare :error symbol, which causes Bolt.Sips.query to fail rather loudly. It looks like the :error is coming from :poolboy's transaction logic (In the v0.4.12 branch at Connection.ex pool_server/3, line 94).

I thought I'd raise this up in case this isn't an intentional hand-off. Normally I would expect to receive { :ok, conn } from Sips.conn if getting an error was possible, since that would force me to match and coincidentally root out :errors early in the stack; that might be a worthwhile change to the Bolt.Sips.conn api.

Thanks for Bolt.Sips! It's been fantastic to work with so far. I'll go see if I can get some logging out of poolboy. :D

Stacktrace if you want it:

7:27:01.222 [error] GenServer #PID<0.113.0> terminating
** (FunctionClauseError) no function clause matching in :ssl.send/2
    ssl.erl:322: :ssl.send(:error, <<0, 2, 176, 14, 0, 0>>) # :error is from Bolt.Sips.conn via :poolboy
    (elixir) lib/enum.ex:769: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:769: Enum.each/2
    (boltex) lib/boltex/bolt.ex:211: Boltex.Bolt.ack_failure/3
    (bolt_sips) lib/bolt_sips/connection.ex:65: anonymous fn/3 in Bolt.Sips.Connection.handle_call/3
    (elixir) lib/enum.ex:3317: Enumerable.List.reduce/3
    (elixir) lib/stream.ex:911: Stream.do_list_transform/7
    (elixir) lib/enum.ex:1990: Enum.reduce_while/3
Last message (from TextClient.Agent): {:error, "MATCH (a:Card { id: $id })\nRETURN a", %{id: "5"}}
florinpatrascu commented 5 years ago

Hi @Tomboyo - thank you for your kind words, about our project. I see you're using the older version of bolt_sips. Would it be possible, for your project, to use the latest version? Regardless, I don't believe the driver is initialized properly, before you run the scripts, but I could be wrong. Can you give us more details? Also, make sure that bolt_sips is started before your script starts doing its intended work i.e. by calling: Application.ensure_all_started(:bolt_sips) - HTH

Tomboyo commented 5 years ago

Hi @florinpatrascu! I didn't realize there was a newer version (doh!), I will switch over to that first thing. I think you're right--I'm definitely doing something wrong with the configuration specifically in my escript artifact (probably a misunderstanding on my part of Elixir configuration). I will do more playing around with the latest version and come back with what I find.

Thanks!

Tomboyo commented 5 years ago

Huzzah, that did the trick. I did run into a bit of a hiccup with the TZData dependency, because by default it was expecting to find some files in the priv/ folder, but my script wasn't necessarily running in a mix-like directory structure. I've overridden the default configuration and called it a day.

Thanks for the help. :) Working like a charm now.