简体   繁体   中英

Neo4j, graphaware: After catching an exception, another query will not execute.

I am connecting to neo4j the normal way and i can run queries no problem.
During testing, i wrote a query that should fail (due to uniqueness constraint), the query does fail as expected and i catch the exception.
The problem is when i try to execute the next query in the queue, it just hangs (longer than timeout).
I don't suppose that is normal behavior.

 try{
     $result = $neo->run ($query);
 }
 catch (Exception $e) {
          // handle it
 }

 // all good so far
 // now we attempt:

try{
    $result = $neo->run ($next_query);
 }
 catch (Exception $e) {
          // handle it
 }
// hangs longer than timeout

if i remove the failed query from the queue, everything completes

So it seems that the exception thrown by the php-client breaks the connection to neo4j.
If i modify the code to the following, it all works fine.

try{
     $result = $neo->run ($query);
 }
 catch (Exception $e) {
          // handle it
      connect_to_neo()
 }

 // all good so far

try{
    $result = $neo->run ($next_query);
 }
 catch (Exception $e) {
          // handle it
 }
 // all good, $next_query gets executed

I do not think that an exception that breaks the connection is desired behavior. Will raise the issue on github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM