-
Notifications
You must be signed in to change notification settings - Fork 89
Orient Spring Data is not calling close() on the database connection. #71
Comments
Based on my prior knowledge of Orient Spring Data, I believe connection closing is tied to thread completion. When the thread using OSD has finished, it will trigger the connection to be closed. I don't believe Spring Data has syntax for closing a connection. I believe OSD is relying upon thread completion to convey when the connection is no longer needed and can be destroyed. |
@robfrank A quick update on this ticket. I have been researching the matter with @dalegarv here at work. It had been over a year since I had reviewed the Orient Spring Data code in detail. I tried to find the code for connection closing after thread completion, but could not find it. I saw the shutdown hooks. In the research that @dalegarv performed, he believes the method below in OSD could be acquiring but not returning connections. The dbf.db() will acquire a connection, but there is no close() after the query is executed. Perhaps this should be in a try/catch/finally block. Can you please review and confirm? @OverRide |
thank you very much. I will verify tomorrow (I'm on UTC+1). |
the lifecycle is managed by the transaction manager. Did you set up the TM? the hello sample app shows how to configure it. |
Yes, and I see an open/close pair being called by the transaction manager. But there's extra opens being called from the methods in org.springframework.data.orient.commons.core.AbstractOrientOperations that are never closed, so the OPartitionedDatabasePool acquiredCount never goes back to 0. For example: @OverRide |
Any update on this issue, please? I encountered this problem as well and it will consumes all connections until the pool was empty. After that, it would be stuck and no response from DB coz no connections were released. It is kind of serious. Please support on this issue and it should be the time to release 0.15, right? Really appreciate. |
Could you please give a quick fix for this bug? Really appreciate |
OrientDB Version: 2.2.18 Enterprise
Orient Spring Data Version: 0.14rc1
Java Version: 1.8
OS: SLES
Expected behavior
For every call to OrientObjectDatabaseFactory.openDatabase() there will be a matching call to DatabaseDocumentTxPooled.close() method so that the acquireCount will go back to 0.
Actual behavior
The openDatabase() method is getting called but not close().
Steps to reproduce
Create a simple test case that calls a find() method using Orient Spring Data, and follow it by a call to openDatabase(). Put a break points just before the call to find(), at the start of openDatabase(), and at the start of close(). The call to find() will cause a call to openDatabase() and the acquireCount will go to 1, but no call to be close() will be made. The second call to openDatabase() after the find() completes will show that the acquireCount is still 1 rather than being decremented back to 0.
Note that this behavior actually improves performance because the connection does not get destroyed since the acquireCount never goes to 0, so the next time the connection is used it's already connected.
The text was updated successfully, but these errors were encountered: