It causes lags on server and server requires restart every 4 hours.
I analyzed heap dump and it leads to this plugin.
It's incremental memory leakage due to mishandling correctly JDBC PreparedStatement/Statement and ResultSet.
The reason is not closing them and they are left present in com.mysql.cj.jdbc.ConnectionImpl#openStatements (CopyOnWriteArrayList):
/**
An array of currently open statements.
Copy-on-write used here to avoid ConcurrentModificationException when statements unregister themselves while we iterate over the list.
*/
private final CopyOnWriteArrayList openStatements = new CopyOnWriteArrayList<>();
Just add these lines before returning anything from function in SQLEconomy.java functions:
result.close();
statement.close();
Also consider surrounding ResultSet with nested try-catch inside already existing try-catch, so statement can be closed if ResultSet fails, and optionally add "&dontTrackOpenResources=true" to jdbc connection parameters (at the end of string), so that statements are not added to openStatements array.
Priority: HIGH/EMERGENCY Issue: Memory leakage Problematic functions:
It causes lags on server and server requires restart every 4 hours. I analyzed heap dump and it leads to this plugin.
It's incremental memory leakage due to mishandling correctly JDBC PreparedStatement/Statement and ResultSet. The reason is not closing them and they are left present in com.mysql.cj.jdbc.ConnectionImpl#openStatements (CopyOnWriteArrayList):
Just add these lines before returning anything from function in SQLEconomy.java functions:
Also consider surrounding ResultSet with nested try-catch inside already existing try-catch, so statement can be closed if ResultSet fails, and optionally add "&dontTrackOpenResources=true" to jdbc connection parameters (at the end of string), so that statements are not added to openStatements array.