I am facing issue with orientdb and getting below exception.
Reached maximum number of concurrent connections (max=1000, current=1000), reject incoming connection from /127.0.0.1:54782 [OServerNetworkListener]
For more analysis I wrote below code for connection create and close.
public class ConnectionsOpenAndClose {
public static void main(String[] args) {
String databaseUrl = <url>;
String username = <username>;
String password = <password>;
OPartitionedDatabasePool pool = openConnections(databaseUrl, username, password);
ODatabaseDocument oDatabaseDocument = pool.acquire();
closeConnections(pool, oDatabaseDocument);
}
private static void closeConnections(OPartitionedDatabasePool pool, ODatabaseDocument oDatabaseDocument) {
if (Objects.nonNull(pool)) {
if (Objects.nonNull(oDatabaseDocument)) {
oDatabaseDocument.activateOnCurrentThread();
oDatabaseDocument.close();
}
pool.close();
}
}
private static OPartitionedDatabasePool openConnections(String databaseUrl, String username, String password) {
OPartitionedDatabasePool pool = new OPartitionedDatabasePool(databaseUrl, username, password);
ODatabaseDocument odbDocument = pool.acquire();
odbDocument.close();
return pool;
}
}
After executing code, I found that on pool.close() or oDatabaseDocument.close(); no binary listeners are getting closed. This, I verified from orientdb studio dashboard. These connections are getting released only after above code terminates from JVM.
Is there any solution for this, how to close these connections? Because after some time orientdb starts rejecting incoming connections, and then eventually orientdb hangs and need to be restarted.
This case is occurring on REDHAT machine where above code is executed and latest Orientdb is on any OS.
Orientdb Version 3.2.23
please do not use OParitionedPool. use the pool provided by the OrientDB class using the method
com.orientechnologies.orient.core.db.OrientDB#cachedPool(java.lang.String, java.lang.String, java.lang.String, com.orientechnologies.orient.core.db.OrientDBConfig)
The class that you use is no longer supported.