From e5470224cf0e9c4bc5ca9a1662aada971d9ad76b Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 21 Nov 2022 11:01:44 +0800 Subject: [PATCH 1/6] test: close all dnodes when tsim execution is complete --- tests/script/sh/sigint_stop_dnodes.sh | 2 +- tests/script/test.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/script/sh/sigint_stop_dnodes.sh b/tests/script/sh/sigint_stop_dnodes.sh index a398e00772..83a4f1c1d5 100755 --- a/tests/script/sh/sigint_stop_dnodes.sh +++ b/tests/script/sh/sigint_stop_dnodes.sh @@ -8,9 +8,9 @@ UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` +echo "Killing taosd processes " $PID while [ -n "$PID" ]; do #echo "Killing taosd processes " $PID kill $PID - PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` done diff --git a/tests/script/test.sh b/tests/script/test.sh index f4979bfa5a..a7a5d34fbe 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -141,6 +141,7 @@ if [ -n "$FILE_NAME" ]; then echo "Execute result:" $result if [ $result -eq 0 ]; then + $CODE_DIR/sh/sigint_stop_dnodes.sh $CODE_DIR/sh/checkAsan.sh else echo "TSIM has asan errors" From 391389e989f7dc7a2f2175b5e75b7671568d9784 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 21 Nov 2022 11:47:55 +0800 Subject: [PATCH 2/6] test: close all dnodes when tsim execution is complete --- tests/parallel_test/cases.task | 7 +- tests/script/tsim/sma/sma_leak.sim | 154 +++++++++++++++++++++++++++++ 2 files changed, 158 insertions(+), 3 deletions(-) create mode 100644 tests/script/tsim/sma/sma_leak.sim diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index a9a02d8380..f9e8cd6271 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -216,7 +216,7 @@ ,,y,script,./test.sh -f tsim/stream/drop_stream.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic1.sim ,,y,script,./test.sh -f tsim/stream/fillHistoryBasic2.sim -,,y,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim +,,n,script,./test.sh -f tsim/stream/fillHistoryBasic3.sim ,,y,script,./test.sh -f tsim/stream/distributeInterval0.sim ,,y,script,./test.sh -f tsim/stream/distributeIntervalRetrive0.sim ,,y,script,./test.sh -f tsim/stream/distributeSession0.sim @@ -227,11 +227,11 @@ ,,y,script,./test.sh -f tsim/stream/triggerSession0.sim ,,y,script,./test.sh -f tsim/stream/partitionby.sim ,,y,script,./test.sh -f tsim/stream/partitionby1.sim -,,y,script,./test.sh -f tsim/stream/schedSnode.sim +,,n,script,./test.sh -f tsim/stream/schedSnode.sim ,,y,script,./test.sh -f tsim/stream/windowClose.sim ,,y,script,./test.sh -f tsim/stream/ignoreExpiredData.sim ,,y,script,./test.sh -f tsim/stream/sliding.sim -,,y,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim +,,n,script,./test.sh -f tsim/stream/partitionbyColumnInterval.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnSession.sim ,,y,script,./test.sh -f tsim/stream/partitionbyColumnState.sim ,,y,script,./test.sh -f tsim/stream/deleteInterval.sim @@ -279,6 +279,7 @@ ,,y,script,./test.sh -f tsim/stable/vnode3.sim ,,y,script,./test.sh -f tsim/stable/metrics_idx.sim ,,n,script,./test.sh -f tsim/sma/drop_sma.sim +,,n,script,./test.sh -f tsim/sma/sma_leak.sim ,,y,script,./test.sh -f tsim/sma/tsmaCreateInsertQuery.sim ,,y,script,./test.sh -f tsim/sma/rsmaCreateInsertQuery.sim ,,y,script,./test.sh -f tsim/sma/rsmaPersistenceRecovery.sim diff --git a/tests/script/tsim/sma/sma_leak.sim b/tests/script/tsim/sma/sma_leak.sim new file mode 100644 index 0000000000..4f2d1ebeb0 --- /dev/null +++ b/tests/script/tsim/sma/sma_leak.sim @@ -0,0 +1,154 @@ +system sh/stop_dnodes.sh +system sh/deploy.sh -n dnode1 -i 1 +system sh/deploy.sh -n dnode2 -i 2 +system sh/deploy.sh -n dnode3 -i 3 +system sh/cfg.sh -n dnode1 -c supportVnodes -v 0 +system sh/cfg.sh -n dnode2 -c supportVnodes -v 4 +system sh/cfg.sh -n dnode3 -c supportVnodes -v 4 + +print ========== step1 +system sh/exec.sh -n dnode1 -s start +sql connect + +print ========== step2 +sql create dnode $hostname port 7200 +sql create dnode $hostname port 7300 +system sh/exec.sh -n dnode2 -s start +system sh/exec.sh -n dnode3 -s start + +$x = 0 +step2: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ====> dnode not ready! + return -1 + endi +sql select * from information_schema.ins_dnodes +print ===> $data00 $data01 $data02 $data03 $data04 $data05 +print ===> $data10 $data11 $data12 $data13 $data14 $data15 +if $rows != 3 then + return -1 +endi +if $data(1)[4] != ready then + goto step2 +endi +if $data(2)[4] != ready then + goto step2 +endi +if $data(3)[4] != ready then + goto step2 +endi + +print ========== step3 +sql create database d1 vgroups 1 +sql use d1; + +print --> create stb +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); + +print --> create sma +sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m); + +return + +print --> show sma +sql show indexes from stb from d1; +if $rows != 1 then + return -1 +endi +if $data[0][0] != sma_index_name1 then + return -1 +endi +if $data[0][1] != d1 then + return -1 +endi +if $data[0][2] != stb then + return -1 +endi + +print --> drop stb +sql drop table stb; + +print ========== step4 repeat + +print --> create stb +sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned); + +print --> create sma +sql create sma index sma_index_name1 on stb function(max(c1),max(c2),min(c1)) interval(6m,10s) sliding(6m); + +print --> show sma +sql show indexes from stb from d1; +if $rows != 1 then + return -1 +endi +if $data[0][0] != sma_index_name1 then + return -1 +endi +if $data[0][1] != d1 then + return -1 +endi +if $data[0][2] != stb then + return -1 +endi + +print --> drop stb +sql drop table stb; + +print ========== step5 +sql drop database if exists db; +sql create database db duration 300; +sql use db; +sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint, c_float float, c_double double, c_bool bool, c_binary binary(16), c_nchar nchar(32), c_ts timestamp, c_tint_un tinyint unsigned, c_sint_un smallint unsigned, c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); +sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; + +print ========== step6 repeat +sql drop database if exists db; +sql create database db duration 300; +sql use db; +sql create table stb1(ts timestamp, c_int int, c_bint bigint ) tags (t_int int); +sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; + +print ========== step7 +sql drop database if exists db; +sql create database db duration 300; +sql use db; +sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); + +sql create table ct1 using stb1 tags ( 1 ); +sql create table ct2 using stb1 tags ( 2 ); +sql create table ct3 using stb1 tags ( 3 ); +sql create table ct4 using stb1 tags ( 4 ); + +sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; +sql CREATE SMA INDEX sma_index_2 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) max_delay 6m; +sql CREATE SMA INDEX sma_index_3 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) watermark 5s max_delay 6m; + +sql DROP INDEX sma_index_1 ; +sql DROP INDEX sma_index_2 ; +sql DROP INDEX sma_index_3 ; + +print ========== step8 +sql drop database if exists db; +sql create database db duration 300; +sql use db; +sql create table stb1(ts timestamp, c_int int, c_bint bigint, c_sint smallint, c_tint tinyint,c_float float, c_double double, c_bool bool,c_binary binary(16), c_nchar nchar(32), c_ts timestamp,c_tint_un tinyint unsigned, c_sint_un smallint unsigned,c_int_un int unsigned, c_bint_un bigint unsigned) tags (t_int int); + +sql create table ct1 using stb1 tags ( 1 ); +sql create table ct2 using stb1 tags ( 2 ); +sql create table ct3 using stb1 tags ( 3 ); +sql create table ct4 using stb1 tags ( 4 ); + +sql CREATE SMA INDEX sma_index_1 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) watermark 5s; +sql CREATE SMA INDEX sma_index_2 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) sliding(6m) max_delay 6m; +sql CREATE SMA INDEX sma_index_3 ON stb1 function(min(c_int), max(c_int)) interval(6m, 10s) watermark 5s max_delay 6m; + +sql DROP INDEX sma_index_1 ; +sql DROP INDEX sma_index_2 ; +sql DROP INDEX sma_index_3 ; + +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode2 -s stop -x SIGINT +system sh/exec.sh -n dnode3 -s stop -x SIGINT +system sh/exec.sh -n dnode4 -s stop -x SIGINT From ada76477fc818986a18fe64a81501445b3d23ed3 Mon Sep 17 00:00:00 2001 From: Minglei Jin Date: Mon, 21 Nov 2022 11:54:25 +0800 Subject: [PATCH 3/6] fix: free stream state cursor --- source/libs/stream/src/streamState.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/libs/stream/src/streamState.c b/source/libs/stream/src/streamState.c index 0374e22a4a..ea31347db5 100644 --- a/source/libs/stream/src/streamState.c +++ b/source/libs/stream/src/streamState.c @@ -411,6 +411,7 @@ int32_t streamStateGetFirst(SStreamState* pState, SWinKey* key) { streamStatePut(pState, &tmp, NULL, 0); SStreamStateCur* pCur = streamStateSeekKeyNext(pState, &tmp); int32_t code = streamStateGetKVByCur(pCur, key, NULL, 0); + streamStateFreeCur(pCur); streamStateDel(pState, &tmp); return code; } From afe7a19ba0f3affe572927b437dba3d1fff24b16 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Mon, 21 Nov 2022 14:09:12 +0800 Subject: [PATCH 4/6] test: add asan case --- tests/parallel_test/cases.task | 24 ++++++++++++------------ tests/script/sh/checkAsan.sh | 9 ++++++++- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/tests/parallel_test/cases.task b/tests/parallel_test/cases.task index f9e8cd6271..890412f8eb 100644 --- a/tests/parallel_test/cases.task +++ b/tests/parallel_test/cases.task @@ -439,31 +439,31 @@ ,,,system-test,python3 ./test.py -f 1-insert/database_pre_suf.py ,,,system-test,python3 ./test.py -f 1-insert/InsertFuturets.py ,,,system-test,python3 ./test.py -f 0-others/show.py -,,,system-test,./pytest.sh python3 ./test.py -f 2-query/abs.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/abs.py ,,,system-test,python3 ./test.py -f 2-query/abs.py -R -,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/and_or_for_byte.py ,,,system-test,python3 ./test.py -f 2-query/and_or_for_byte.py -R -,,,system-test,./pytest.sh python3 ./test.py -f 2-query/apercentile.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/apercentile.py ,,,system-test,python3 ./test.py -f 2-query/apercentile.py -R -,,,system-test,python3 ./test.py -f 2-query/arccos.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arccos.py ,,,system-test,python3 ./test.py -f 2-query/arccos.py -R -,,,system-test,python3 ./test.py -f 2-query/arcsin.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arcsin.py ,,,system-test,python3 ./test.py -f 2-query/arcsin.py -R -,,,system-test,python3 ./test.py -f 2-query/arctan.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/arctan.py ,,,system-test,python3 ./test.py -f 2-query/arctan.py -R ,,,system-test,python3 ./test.py -f 2-query/avg.py ,,,system-test,python3 ./test.py -f 2-query/avg.py -R -,,,system-test,python3 ./test.py -f 2-query/between.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/between.py ,,,system-test,python3 ./test.py -f 2-query/between.py -R -,,,system-test,python3 ./test.py -f 2-query/bottom.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/bottom.py ,,,system-test,python3 ./test.py -f 2-query/bottom.py -R -,,,system-test,python3 ./test.py -f 2-query/cast.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/cast.py ,,,system-test,python3 ./test.py -f 2-query/cast.py -R -,,,system-test,python3 ./test.py -f 2-query/ceil.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ceil.py ,,,system-test,python3 ./test.py -f 2-query/ceil.py -R -,,,system-test,python3 ./test.py -f 2-query/char_length.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/char_length.py ,,,system-test,python3 ./test.py -f 2-query/char_length.py -R -,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py +,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/check_tsdb.py ,,,system-test,python3 ./test.py -f 2-query/check_tsdb.py -R ,,,system-test,python3 ./test.py -f 2-query/concat.py ,,,system-test,python3 ./test.py -f 2-query/concat.py -R diff --git a/tests/script/sh/checkAsan.sh b/tests/script/sh/checkAsan.sh index 8759db8722..074956534f 100755 --- a/tests/script/sh/checkAsan.sh +++ b/tests/script/sh/checkAsan.sh @@ -21,7 +21,14 @@ LOG_DIR=$TAOS_DIR/sim/asan error_num=`cat ${LOG_DIR}/*.asan | grep "ERROR" | wc -l` memory_leak=`cat ${LOG_DIR}/*.asan | grep "Direct leak" | wc -l` indirect_leak=`cat ${LOG_DIR}/*.asan | grep "Indirect leak" | wc -l` -runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | wc -l` + +# ignore +# /root/TDengine/source/libs/scalar/src/sclfunc.c:735:11: runtime error: 4.75783e+11 is outside the range of representable values of type 'signed char' +# /root/TDengine/source/libs/scalar/src/sclfunc.c:790:11: runtime error: 3.4e+38 is outside the range of representable values of type 'long int' +# /root/TDengine/source/libs/scalar/src/sclfunc.c:772:11: runtime error: 3.52344e+09 is outside the range of representable values of type 'int' +# /root/TDengine/source/libs/scalar/src/sclfunc.c:753:11: runtime error: 4.75783e+11 is outside the range of representable values of type 'short int' +runtime_error=`cat ${LOG_DIR}/*.asan | grep "runtime error" | grep -v "trees.c:873" | grep -v "sclfunc.c.*outside the range of representable values of type" | wc -l` + python_error=`cat ${LOG_DIR}/*.info | grep -w "stack" | wc -l` echo -e "\033[44;32;1m"asan error_num: $error_num"\033[0m" From 36a43fc016ae9db8b598d9be86e762e8a3e01003 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Mon, 21 Nov 2022 14:46:46 +0800 Subject: [PATCH 5/6] fix: set sleep time to 10s, set curl timeout --- packaging/docker/run.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index b5d6b011ea..b02b3cbd8a 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -4,7 +4,7 @@ TAOS_RUN_TAOSBENCHMARK_TEST_ONCE=0 #ADMIN_URL=${ADMIN_URL:-http://172.26.10.84:10001} TAOSD_STARTUP_TIMEOUT_SECOND=${TAOSD_STARTUP_TIMEOUT_SECOND:-160} TAOS_TIMEOUT_SECOND=${TAOS_TIMEOUT_SECOND:-5} -BACKUP_CORE_FOLDER=/data/corefile +BACKUP_CORE_FOLDER=/var/log/corefile ALERT_URL=app/system/alert/add echo "ADMIN_URL: ${ADMIN_URL}" @@ -37,7 +37,7 @@ function post_error_msg() { echo "service_state: ${service_state}" echo "`date` service_msg: ${service_msg}" echo "${taos_version}" - curl -X POST -H "Content-Type: application/json" \ + curl --connect-timeout 10 --max-time 20 -X POST -H "Content-Type: application/json" \ -d"{\"appName\":\"${app_name}\",\ \"alertLevel\":\"${service_state}\",\ \"taosVersion\":\"${taos_version}\",\ @@ -77,7 +77,7 @@ function post_disk_error_msg() { echo "disk_state: ${disk_state}" echo "`date` disk_msg: ${disk_msg}" echo "${taos_version}" - curl -X POST -H "Content-Type: application/json" \ + curl --connect-timeout 10 --max-time 20 -X POST -H "Content-Type: application/json" \ -d"{\"appName\":\"${app_name}\",\ \"alertLevel\":\"${disk_state}\",\ \"taosVersion\":\"${taos_version}\",\ @@ -200,5 +200,5 @@ do if [ $? -ne 0 ]; then taosadapter & fi - sleep 30 + sleep 10 done From f7f7b97279d9c87e12d73ab4410174a186fd38c1 Mon Sep 17 00:00:00 2001 From: tangfangzhi Date: Mon, 21 Nov 2022 15:19:19 +0800 Subject: [PATCH 6/6] fix: mv does not work cross devices --- packaging/docker/run.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index b02b3cbd8a..3654beadcb 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -59,7 +59,8 @@ function check_taosd_exit_type() { if [ ! -z "$core_files" ]; then # move core files to another folder mkdir -p ${BACKUP_CORE_FOLDER} - mv ${core_folder}/${core_prefix}* ${BACKUP_CORE_FOLDER}/ + cp ${core_folder}/${core_prefix}* ${BACKUP_CORE_FOLDER}/ + rm -f ${core_folder}/${core_prefix}* set_service_state "error" "taosd exit with core file" else set_service_state "error" "taosd exit without core file"