florinpatrascu / bolt_sips

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

timeout is happening while querying. #71

Closed yatender-oktalk closed 4 years ago

yatender-oktalk commented 4 years ago

stacktrace

** (Bolt.Sips.Exception) timeout
    (bolt_sips) lib/bolt_sips/query.ex:59: Bolt.Sips.Query.query!/3

Environment

Erlang/OTP 22 
IEx 1.9.1 (compiled with Erlang/OTP 22)
* Neo4j version (Neo4j 3.5.1):
* Bolt.Sips version: "1.5.1",
* Operating system: macOS 10.14.4
* Connection config 
config :bolt_sips, Bolt,
  hostname: 'hostname.com',
  basic_auth: [username: "user", password: "****"],
  port: 7687,
  pool_size: 50,
  max_overflow: 5,
  timeout: 5_000,
  retry_linear_backoff: [delay: 150, factor: 2, tries: 3]

while executing query randomly it gives timeout then again after retrying it works fine. I was using previously :neo4j_sips, "0.2.18", it never gave such timeouts. I decided to move it to this library then this is happening let me know if you want any other info which can help you to debug this issue or in case I'm doing something wrong.

florinpatrascu commented 4 years ago

can you time the db response, for the query you're running? It might be that your query takes longer to execute? Also, you might try the latest version of bolt-sips, the 2.0.0-rc.x

The other driver you refer to, was using neo4j's older REST API, for communicating with the server.

yatender-oktalk commented 4 years ago

No query doesn't take time at all, it's just a simple search query on indexed field with limit 1, sometimes it just execute within 1 ms and sometimes it just don't connect at all, I tried using the 2.0.0-rc.x only but there was also same case so I thought of using this one but this version also gives the same issue.

florinpatrascu commented 4 years ago

It’s very weird. I honestly don’t believe it’s from the driver. Since you tried both versions, and thank you for that, you also tried two different implementations of db_connection, the library we use for managing the connections to the server. I highly doubt we would’ve missed a issue like this. But everything it’s possible. Can you make sure the server is responsive?? Of curiosity, is your server running from a Docker container?

yatender-oktalk commented 4 years ago

Yeah server is responsive, when I restart the application it gives me results but as soon as i keep application idle and don't do any query it starts giving timeout for next queries I do after keeping it idle. No I'm not running in docker container it's a standalone server only.

florinpatrascu commented 4 years ago

for how long was the application "idle"? Also can you please set the :idle_interval to 5000?

florinpatrascu commented 4 years ago

also please check: #67, too.

yatender-oktalk commented 4 years ago

idle_interval: 5000 now

steps I'm doing basically

67 I checked already but we are not using any reverse proxy or anything.

florinpatrascu commented 4 years ago

I am sorry, I cannot reproduce this. I kept a Neo4j 3.5.3 server open and an app idle for 20 minutes now and I can still get the query running. Forced :idle_interval to 100.

yatender-oktalk commented 4 years ago

if possible can u give me your email id?

yatender-oktalk commented 4 years ago

looks like some issue with the Neo4j 3.5.1 only (i guess), when I'm trying with Neo4j 3.5.8 version it hasn't given timeout exception yet, in last 30 mins I'm connected with it and it's working fine till now, will keep you updated.

yatender-oktalk commented 4 years ago

somehow, everything is working fine now, for Neo4j 3.5.8 & Neo4j 3.5.1 versions. don't know what was the issue, thank you so much for help. will close the ticket for now.