taosdata / TDengine

High-performance, scalable time-series database designed for Industrial IoT (IIoT) scenarios
https://tdengine.com
GNU Affero General Public License v3.0
23.4k stars 4.86k forks source link

Java schemaless writer crashes #11783

Closed luxs-yy closed 6 months ago

luxs-yy commented 2 years ago

tdengine 版本:Client Version:2.4.0.16

taos jdbcdriver 版本: 2.0.38

客户端版本:TDengine-client-2.4.0.16-Windows-x64.exe

运行官方示例:

package com.lksoft.iot.tsdbservice;

import com.taosdata.jdbc.SchemalessWriter;
import com.taosdata.jdbc.enums.SchemalessProtocolType;
import com.taosdata.jdbc.enums.SchemalessTimestampType;
import lombok.extern.slf4j.Slf4j;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

@Slf4j
public class Test {
    private static final String host = "xxxx";
    private static final String lineDemo = "st,t1=3i64,t2=4f64,t3=\"t3\" c1=3i64,c3=L\"passit\",c2=false,c4=4f64 1626006833639000000";
    private static final String telnetDemo = "stb0_0 1626006833 4 host=host0 interface=eth0";
    private static final String jsonDemo = "{\"metric\": \"meter_current\",\"timestamp\": 1346846400,\"value\": 10.3, \"tags\": {\"groupid\": 2, \"location\": \"Beijing\", \"id\": \"d1001\"}}";
    public static void main(String[] args) throws SQLException {
        final String url = "jdbc:TAOS://" + host + ":46030/?user=root&password=taosdata";
        try (Connection connection = DriverManager.getConnection(url)) {
            init(connection);
            SchemalessWriter writer = new SchemalessWriter(connection);
            log.info("准备行写入:{}",lineDemo);
            writer.write(lineDemo, SchemalessProtocolType.LINE, SchemalessTimestampType.NANO_SECONDS);
            writer.write(telnetDemo, SchemalessProtocolType.TELNET, SchemalessTimestampType.MILLI_SECONDS);
            writer.write(jsonDemo, SchemalessProtocolType.JSON, SchemalessTimestampType.NOT_CONFIGURED);
        }
    }
    private static void init(Connection connection) throws SQLException {
        try (Statement stmt = connection.createStatement()) {
            stmt.executeUpdate("drop database if exists test_schemaless");
            stmt.executeUpdate("create database if not exists test_schemaless");
            stmt.executeUpdate("use test_schemaless");
        }
    }
}

过了一会控制台报错

"C:\Program Files\Java\jdk1.8.0_271\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:63475,suspend=y,server=n -javaagent:C:\Users\hongy\AppData\Local\JetBrains\IntelliJIdea2020.3\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_271\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_271\jre\lib\rt.jar;E:\lksoft-project-idea\lksoft-iot-xdc\iot-tsdb-service\target\classes;D:\repo\org\springframework\boot\spring-boot-starter-actuator\2.6.6\spring-boot-starter-actuator-2.6.6.jar;D:\repo\org\springframework\boot\spring-boot-starter\2.6.6\spring-boot-starter-2.6.6.jar;D:\repo\org\springframework\boot\spring-boot\2.6.6\spring-boot-2.6.6.jar;D:\repo\org\springframework\boot\spring-boot-starter-logging\2.6.6\spring-boot-starter-logging-2.6.6.jar;D:\repo\ch\qos\logback\logback-classic\1.2.11\logback-classic-1.2.11.jar;D:\repo\ch\qos\logback\logback-core\1.2.11\logback-core-1.2.11.jar;D:\repo\org\apache\logging\log4j\log4j-to-slf4j\2.17.2\log4j-to-slf4j-2.17.2.jar;D:\repo\org\apache\logging\log4j\log4j-api\2.17.2\log4j-api-2.17.2.jar;D:\repo\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\repo\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\repo\org\springframework\spring-core\5.3.18\spring-core-5.3.18.jar;D:\repo\org\springframework\spring-jcl\5.3.18\spring-jcl-5.3.18.jar;D:\repo\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar;D:\repo\org\springframework\boot\spring-boot-actuator-autoconfigure\2.6.6\spring-boot-actuator-autoconfigure-2.6.6.jar;D:\repo\org\springframework\boot\spring-boot-actuator\2.6.6\spring-boot-actuator-2.6.6.jar;D:\repo\com\fasterxml\jackson\core\jackson-databind\2.13.2.2\jackson-databind-2.13.2.2.jar;D:\repo\com\fasterxml\jackson\core\jackson-annotations\2.13.2\jackson-annotations-2.13.2.jar;D:\repo\com\fasterxml\jackson\core\jackson-core\2.13.2\jackson-core-2.13.2.jar;D:\repo\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.2\jackson-datatype-jsr310-2.13.2.jar;D:\repo\io\micrometer\micrometer-core\1.8.4\micrometer-core-1.8.4.jar;D:\repo\org\hdrhistogram\HdrHistogram\2.1.12\HdrHistogram-2.1.12.jar;D:\repo\org\latencyutils\LatencyUtils\2.0.3\LatencyUtils-2.0.3.jar;D:\repo\org\springframework\boot\spring-boot-starter-jdbc\2.6.6\spring-boot-starter-jdbc-2.6.6.jar;D:\repo\com\zaxxer\HikariCP\4.0.3\HikariCP-4.0.3.jar;D:\repo\org\springframework\spring-jdbc\5.3.18\spring-jdbc-5.3.18.jar;D:\repo\org\springframework\spring-beans\5.3.18\spring-beans-5.3.18.jar;D:\repo\org\springframework\spring-tx\5.3.18\spring-tx-5.3.18.jar;D:\repo\com\alibaba\druid-spring-boot-starter\1.1.10\druid-spring-boot-starter-1.1.10.jar;D:\repo\com\alibaba\druid\1.1.10\druid-1.1.10.jar;D:\repo\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\repo\org\springframework\boot\spring-boot-autoconfigure\2.6.6\spring-boot-autoconfigure-2.6.6.jar;D:\repo\com\baomidou\mybatis-plus-boot-starter\3.1.2\mybatis-plus-boot-starter-3.1.2.jar;D:\repo\com\baomidou\mybatis-plus\3.1.2\mybatis-plus-3.1.2.jar;D:\repo\com\baomidou\mybatis-plus-extension\3.1.2\mybatis-plus-extension-3.1.2.jar;D:\repo\com\baomidou\mybatis-plus-core\3.1.2\mybatis-plus-core-3.1.2.jar;D:\repo\com\baomidou\mybatis-plus-annotation\3.1.2\mybatis-plus-annotation-3.1.2.jar;D:\repo\com\github\jsqlparser\jsqlparser\1.2\jsqlparser-1.2.jar;D:\repo\org\mybatis\mybatis\3.5.1\mybatis-3.5.1.jar;D:\repo\org\mybatis\mybatis-spring\2.0.1\mybatis-spring-2.0.1.jar;D:\repo\org\springframework\boot\spring-boot-starter-web\2.6.6\spring-boot-starter-web-2.6.6.jar;D:\repo\org\springframework\boot\spring-boot-starter-json\2.6.6\spring-boot-starter-json-2.6.6.jar;D:\repo\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.2\jackson-datatype-jdk8-2.13.2.jar;D:\repo\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.2\jackson-module-parameter-names-2.13.2.jar;D:\repo\org\springframework\boot\spring-boot-starter-tomcat\2.6.6\spring-boot-starter-tomcat-2.6.6.jar;D:\repo\org\apache\tomcat\embed\tomcat-embed-core\9.0.60\tomcat-embed-core-9.0.60.jar;D:\repo\org\apache\tomcat\embed\tomcat-embed-el\9.0.60\tomcat-embed-el-9.0.60.jar;D:\repo\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.60\tomcat-embed-websocket-9.0.60.jar;D:\repo\org\springframework\spring-web\5.3.18\spring-web-5.3.18.jar;D:\repo\org\springframework\spring-webmvc\5.3.18\spring-webmvc-5.3.18.jar;D:\repo\org\springframework\spring-aop\5.3.18\spring-aop-5.3.18.jar;D:\repo\org\springframework\spring-context\5.3.18\spring-context-5.3.18.jar;D:\repo\org\springframework\spring-expression\5.3.18\spring-expression-5.3.18.jar;D:\repo\org\projectlombok\lombok\1.18.24\lombok-1.18.24.jar;D:\repo\com\taosdata\jdbc\taos-jdbcdriver\2.0.38\taos-jdbcdriver-2.0.38.jar;D:\repo\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;D:\repo\org\apache\httpcomponents\httpcore\4.4.15\httpcore-4.4.15.jar;D:\repo\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;D:\repo\com\google\guava\guava\30.1.1-jre\guava-30.1.1-jre.jar;D:\repo\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;D:\repo\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\repo\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;D:\repo\org\checkerframework\checker-qual\3.8.0\checker-qual-3.8.0.jar;D:\repo\com\google\errorprone\error_prone_annotations\2.5.1\error_prone_annotations-2.5.1.jar;D:\repo\com\google\j2objc\j2objc-annotations\1.3\j2objc-annotations-1.3.jar;D:\repo\org\java-websocket\Java-WebSocket\1.5.2\Java-WebSocket-1.5.2.jar;D:\repo\org\springframework\boot\spring-boot-configuration-processor\2.6.6\spring-boot-configuration-processor-2.6.6.jar;E:\lksoft-project-idea\lksoft-iot-xdc\lksoft-commons\target\classes;D:\repo\org\springframework\integration\spring-integration-mqtt\5.5.10\spring-integration-mqtt-5.5.10.jar;D:\repo\org\springframework\integration\spring-integration-core\5.5.10\spring-integration-core-5.5.10.jar;D:\repo\org\springframework\spring-messaging\5.3.18\spring-messaging-5.3.18.jar;D:\repo\org\springframework\retry\spring-retry\1.3.2\spring-retry-1.3.2.jar;D:\repo\io\projectreactor\reactor-core\3.4.16\reactor-core-3.4.16.jar;D:\repo\org\reactivestreams\reactive-streams\1.0.3\reactive-streams-1.0.3.jar;D:\repo\org\eclipse\paho\org.eclipse.paho.client.mqttv3\1.2.5\org.eclipse.paho.client.mqttv3-1.2.5.jar;D:\repo\com\alibaba\fastjson\2.0.1\fastjson-2.0.1.jar;D:\repo\com\alibaba\fastjson2\fastjson2-extension\2.0.1\fastjson2-extension-2.0.1.jar;D:\repo\com\alibaba\fastjson2\fastjson2\2.0.1\fastjson2-2.0.1.jar;D:\soft\JetBrains\IntelliJ IDEA 2020.3\lib\idea_rt.jar" com.lksoft.iot.tsdbservice.Test
Connected to the target VM, address: '127.0.0.1:63475', transport: 'socket'
23:52:54.638 [main] INFO com.lksoft.iot.tsdbservice.Test - 准备行写入:st,t1=3i64,t2=4f64,t3="t3" c1=3i64,c3=L"passit",c2=false,c4=4f64 1626006833639000000
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00007fffd33cdf6b, pid=25640, tid=0x0000000000007b64
#
# JRE version: Java(TM) SE Runtime Environment (8.0_271-b09) (build 1.8.0_271-b09)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.271-b09 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C  [taos.dll+0x6df6b]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# E:\lksoft-project-idea\lksoft-iot-xdc\hs_err_pid25640.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Disconnected from the target VM, address: '127.0.0.1:63475', transport: 'socket'

Process finished with exit code 1

hs_err_pid25640.log hs_err_pid25640.log

huolibo commented 2 years ago

我本地 linux 环境测试没有crash。你在服务器(linux 环境)上做下测试看是否还有问题?

yu285 commented 6 months ago

2.x 版本目前官方已经不维护支持了,请迁移升级到最新的 3.x 版本吧。操作手册为:https://www.taosdata.com/tdengine-engineering/17753.html。3.x 和 2.x 相比是全方位更加优越的,关于3.x 的主要特性可以结合这篇文章和官方文档一起了解:https://www.taosdata.com/tdengine-engineering/21550.html