com.taosdata.jdbc 2.0.2 Memory leak
com.taosdata.jdbc 2.0.2 Memory leak
TDEngine与测试Client均为CentOS Linux release 7.8.2003 (Core)
连续写入数据时,存在内存泄漏导致软件崩溃
相关信息如下:
public Connection getConn() throws Exception{
Class.forName("com.taosdata.jdbc.TSDBDriver");
String jdbcUrl = "jdbc:TAOS://xx.xx.xx.xx:6030/?user=root&password=taosdata";
Properties connProps = new Properties();
connProps.setProperty(TSDBDriver.PROPERTY_KEY_USER, "root");
connProps.setProperty(TSDBDriver.PROPERTY_KEY_PASSWORD, "taosdata");
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CONFIG_DIR, "/etc/taos");
connProps.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8");
connProps.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8");
connProps.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8");
Connection conn = DriverManager.getConnection(jdbcUrl, connProps);
return conn;
}
public void jdbcDemoUpdate(Connection con, String sql) throws Exception { Statement stmt = null; try { stmt = con.createStatement(); stmt.executeUpdate(sql); }catch(Exception ex) { System.out.println(ex.getMessage()); }finally { try { if (stmt != null){ stmt.close(); } }catch (Exception e){ e.printStackTrace(); } } }
public void start() throws Exception {
Connection con = getConn();
int totalCount = 0;
while(true) {
totalCount ++;
Date dtS = new Date();
Date dt = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(dtS);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
int iCount = 5000;
Random rand = new Random();
for (int i = 0; i < iCount; i++) {
calendar.set(Calendar.SECOND, calendar.get(Calendar.SECOND) + 1);//让日期加1
dt = calendar.getTime();
String sql = "INSERT INTO " + Db + ".TestWrite VALUES('" + sdf.format(dt) + "', " + rand.nextInt() + ") ";
jdbcDemoUpdate(con, sql);
}
Date dtE = new Date();
System.out.println(totalCount + "---" + sdf.format(dtS) + "\t" + sdf.format(dtE));
}
}
50万记录写入,客户端内存增加到2g+
+1,我也遇到了,测试了2.0.1版本和2.0.4版本,都是相同问题,issue里有人提交memory leak fix,所以下载最新版又测试了一遍,但是问题依旧存在
Server 1.6.6.1,java jdbc 1.0.3测试OK。应该是新版的问题。
1.6版本的可以集群吗
1.6版本的可以集群吗
2.0才开源集群。
Memory leak during insert has been fixed. You can pull the latest code on the master branch and retry. Thanks! @PascalMing @jin522