From 3aab4b024f101bb79f3bfb9cfc241fe97409d91e Mon Sep 17 00:00:00 2001 From: Linhe Huo Date: Wed, 8 Sep 2021 10:15:04 +0800 Subject: [PATCH] [TD-6535]: force cleanup tscCache to close tsc timer, which will cause segmentfault (#7818) * [TD-6535]: force cleanup tscCache to close tsc timer, which will cause segmentfault * [TD-6543]: document support compile with dotnet sdk --- src/util/src/tcache.c | 2 +- tests/examples/C#/taosdemo/Dockerfile | 24 +++++++++++++ tests/examples/C#/taosdemo/README.md | 39 +++++++++++++++++++--- tests/examples/C#/taosdemo/taosdemo.csproj | 9 +++++ 4 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 tests/examples/C#/taosdemo/Dockerfile create mode 100644 tests/examples/C#/taosdemo/taosdemo.csproj diff --git a/src/util/src/tcache.c b/src/util/src/tcache.c index 776a0ad9c8..6665c25a90 100644 --- a/src/util/src/tcache.c +++ b/src/util/src/tcache.c @@ -645,7 +645,7 @@ void doCleanupDataCache(SCacheObj *pCacheObj) { // todo memory leak if there are object with refcount greater than 0 in hash table? taosHashCleanup(pCacheObj->pHashTable); - taosTrashcanEmpty(pCacheObj, false); + taosTrashcanEmpty(pCacheObj, true); __cache_lock_destroy(pCacheObj); diff --git a/tests/examples/C#/taosdemo/Dockerfile b/tests/examples/C#/taosdemo/Dockerfile new file mode 100644 index 0000000000..4eefc6c752 --- /dev/null +++ b/tests/examples/C#/taosdemo/Dockerfile @@ -0,0 +1,24 @@ +FROM tdengine/tdengine-beta:latest + +ENV DEBIAN_FRONTEND=noninteractive +ARG MIRROR=archive.ubuntu.com +RUN sed -Ei 's/\w+.ubuntu.com/'${MIRROR}'/' /etc/apt/sources.list && apt update && apt install mono-devel -y +RUN apt-get install wget -y \ + && wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && rm packages-microsoft-prod.deb \ + && apt-get update && apt-get install -y dotnet-sdk-5.0 +COPY ./*.cs *.csproj /tmp/ +WORKDIR /tmp/ +RUN dotnet build -c Release && cp bin/Release/net5.0/taosdemo bin/Release/net5.0/taosdemo.* /usr/local/bin/ && rm -rf /tmp/* + +FROM tdengine/tdengine-beta:latest + +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install wget -y \ + && wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && rm packages-microsoft-prod.deb \ + && apt-get update && apt-get install -y dotnet-runtime-5.0 +COPY --from=0 /usr/local/bin/taosdemo* /usr/local/bin/ +CMD ["/usr/local/bin/taosdemo"] diff --git a/tests/examples/C#/taosdemo/README.md b/tests/examples/C#/taosdemo/README.md index 2d125fb140..3cba3529bf 100644 --- a/tests/examples/C#/taosdemo/README.md +++ b/tests/examples/C#/taosdemo/README.md @@ -1,13 +1,41 @@ +# C# Taosdemo + +## For Mono + install build environment -=== + +```sh yum/apt install mono-complete +``` -build C# version taosdemo -=== +build C# version taosdemo. + +```sh mcs -out:taosdemo *.cs +./taosdemo --help +``` + +## For DotNet + +install dotnet environment. + +```sh +wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \ + && dpkg -i packages-microsoft-prod.deb \ + && rm packages-microsoft-prod.deb \ + && apt-get update && apt-get install -y dotnet-sdk-5.0 +``` + +Build DotNet version taosdemo. + +```sh +dotnet build -c Release +./bin/Release/net5.0/taosdemo --help +``` + +## Usage -run C# version taosdemo -=== +``` Usage: mono taosdemo.exe [OPTION...] --help Show usage. @@ -34,3 +62,4 @@ Usage: mono taosdemo.exe [OPTION...] -v Print verbose output -g Print debug output -y Skip read key for continous test, default is not skip +``` diff --git a/tests/examples/C#/taosdemo/taosdemo.csproj b/tests/examples/C#/taosdemo/taosdemo.csproj new file mode 100644 index 0000000000..15ec155d45 --- /dev/null +++ b/tests/examples/C#/taosdemo/taosdemo.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + false + + + -- GitLab