List transactions with no current query

When trying to see what transactions are running, we see some blank rows from time to time, for example

neo4j> CALL dbms.listTransactions() YIELD transactionId, currentQuery, elapsedTimeMillis,status;
+----------------------------------------------------------------------------------------------------------------------------------------------------+
| transactionId       | currentQuery                                                                                 | elapsedTimeMillis | status    |
+----------------------------------------------------------------------------------------------------------------------------------------------------+
| "transaction-27535" | ""                                                                                           | 60002             | "Running" |

What is that mean, the transaction is committing, and there is no query currently running?

It's possible to begin or create new transactions but not yet run anything. Likewise, a transaction may have finished executing a query, but may not yet have been committed or rolled back.

1 Like

Thanks and there is no way to manually kill a transaction, correct?

There's a proc to kill a query based on the query id, but that won't help in this case. You may want to look at neo4j.conf properties you can set to auto-kill transactions after a given amount of time.

Take a look at
dbms.transaction.timeout
and
dbms.lock.acquisition.timeout
If you use these, you'll probably want to set the same timeout value to both of them.

Yeah i am familiar with these settings, not a big fan of them as they are very much global. I know i can set the setting dynamically and then go back to default. But previously it seemed that the timeout setting when set doesn't apply to in-flight transaction. and I was trying to avoid a restart

Understood. It's definitely a worthwhile feature request, we've passed this along to our Cypher team.

Is there a way to log queries that ran as part of tx or somehow correlated this transaction-id to queries after they have run? Like in my case above, I would like to know what query was run during this transaction that is being committed?

If using the latest drivers, there should be richer capability to both add metadata to transactions, and also to set timeouts per transaction.

If using the Java driver, for example, in the API for Session you can see that most of the methods for executing transactions can take a TransactionConfig parameter, and if you look at the examples for usage you can see that you can set the timeout that will be used, as well as add in metadata that will be logged in the servers query.log file (provided query logging is enabled) as well as listed when running dbms.listTransactions().

See our release article on the Neo4j 1.7 drivers for more info on the added capabilities.