Alberto
Alberto

Reputation: 607

Neo4j timeout not working

I am running some tests on Neo4j, including the execution of a query computing the longest shortest path of my big graph. As I expect that query to take really long time I used the instructions I found here to set a timeout of 30 minutes.

I noticed that the query kept on running for long time (I had to manually kill it) even if the timeout was set. However, this issue disappeared if I set a really low timeout (e.g. 10 millis). Does anybody know what's going on?

Thanks in advance.

Upvotes: 4

Views: 569

Answers (1)

FylmTM
FylmTM

Reputation: 2007

As far as I know - guard functionality is deprecated (check answer here). There is no mention about this functionality in current stable Neo4j release documentation.

I think best you can do in this case - manage query execution time at client side. This can give you enough flexibility for managing different timeout times, for different queries.

In Java, for example you can start you query in separate Thread, and wait for result until some timeout is reached.

Neo4j 2.3+

If you are not using latest stable Neo4j release (2.3.1 ast time of writing), then you definitely should try to upgrade.

2.3 was quite significant release, with a lot of bugfixes and new functionality. So, probably your issue is already fixed.

Plugin

Additionally you can create simple Neo4j plugin, which will:

  • Receive query and timeout value
  • Execute in Neo4j via GraphDatabaseService
  • If execution reaches timeout, then terminate transaction
  • If query executes successfully, return response

Upvotes: 3

Related Questions