Can readTransaction and writeTransaction after a session.close()?
See original GitHub issueWith my NestJs application, I want to create a Session by request and close it at the end of client request of my API. Unfortunately, I try this:
let session = this.neo4j.session();
session.close();
session.readTransaction(tx=>...);
And it works… I have my data. What is the mechanism behind all this? readTransaction and writeTransaction reopen the session? How can be sure to close really a session? Regards.
Neo4j Version: 3.5.3
Neo4j Mode: Single instance
Driver version: JS driver 1.7.6
Operating System: Linux Mint 19.2
Steps to reproduce
- Create a session
- Close it
- Run a query with readTransaction or writeTransaction
- Look the result
Expected behavior
Throw exception?
Actual behavior
I don’t know… I think readTransaction or writeTransaction reopen session.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Difference between session.run and session.readTra... - Neo4j
Solved: In Javascript driver, what is the difference between running Cypher queries using session.run() and session.readTransaction((tx) - 46037.
Read more >How to properly return a StatementResult with a Transaction ...
Should I keep using the execute() function, the session.writeTransaction() function ? It seems to me that there is a lot of way of...
Read more >Session (Neo4j Java Driver 4.3.3 API) - Javadoc.io
Execute a unit of work in a managed read transaction. This transaction will automatically be committed unless an exception is thrown during query...
Read more >org.neo4j.driver.v1.Session.writeTransaction java ... - Tabnine
Transaction will automatically be committed unless exception is thrown from the unit of work itself or from Transaction#close() or transaction is explicitly ...
Read more >About transactions | Cloud Spanner
Read-only transactions do not need to be committed and do not take locks. ... The following shows how to execute a read-write transaction:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @mehdikwa,
In 1.7, if you give a callback in
session.close(callback)
, then once the callback is done, then all session resources (such as connections) are all released (return to a connection pool on driver).The threads used on server is not strictly related to the connections the Neo4j server handles. Also the server has many thread pools besides the pool used by bolt server. If you want to change the default thread pool settings of bolt server, here are some instructions to change them.
Hello,
If the session is still alive after closing it, will it mean that the session keeps an opened slot in the pool of connections and affects number of threads used in the cluster ? We are experiencing this behavior in a sense where we open a connexion for every function and closing it after return. But seems threads on server keeps increasing till overloading CPU usage.