neo4j / neo4j-go-driver

Neo4j Bolt Driver for Go
Apache License 2.0
490 stars 69 forks source link

Neo4jError: "BoltProtocol.sessionExpired" ("Session expired.") #578

Closed gsingh-ds closed 5 months ago

gsingh-ds commented 5 months ago

Example bug report

I get Neo4jError: "BoltProtocol.sessionExpired" ("Session expired.") many time in my application.

Neo4j Mode: Single instance
Driver version: Go driver 5.18 Operating System: Ubuntu 16.10 on AWS

Steps to reproduce

  1. Start Neo4j on a AWS instance
  2. Run a query with the driver
  3. Put the driver idle for 2h
  4. Run another query

    Expected behavior

    The second query shall run successfully

    Actual behavior

    The client failed to run the second query with a Neo4jError: "BoltProtocol.sessionExpired" ("Session expired.") stacktrace.

fbiville commented 5 months ago

Hello, thanks for the report. Can you please share an example of "run[ning] a query with the driver"? What API are you using? Can you also share the Bolt logs from the Go application?

gsingh-ds commented 5 months ago

I am using the driver for AWS Neptune.

fbiville commented 5 months ago

Step 1 says "Start Neo4j on a AWS instance". Are you using Neo4j or Neptune? If it's a Neptune issue, we won't be able to help.

gsingh-ds commented 5 months ago

sorry about that, it is Neptune. Is there exponential backoff and retry strategy implementation example in golang?

fbiville commented 5 months ago

@gsingh-ds there is a built-in retry mechanism on some errors when you use the session#ExecuteRead and session#ExecuteWrite APIs. It is implemented as an exponential backoff. There is also a public API that exposes the error predicate function that is used, which is called neo4j.IsRetryable(error). By the looks of it, I don't think the error you get is deemed retryable.

StephenCathcart commented 5 months ago

Hi @gsingh-ds, unfortunately as this is Neptune and not Neo4j we aren't able to help. If you notice this behavior when using Neo4j too, we can reopen this issue. If so please include any bolt logs, example query, and how you're using the driver with what config to help us track the issue down. Thanks

gsingh-ds commented 5 months ago

@fbiville does exponential backoff also implemetned in session#ExecuteQuery ? if now why? and can we do it?