• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

taosdata / TDengine / #4950

06 Feb 2026 07:29AM UTC coverage: 66.849% (-0.1%) from 66.973%
#4950

push

travis-ci

web-flow
merge: from main to 3.0 #34521

759 of 1081 new or added lines in 28 files covered. (70.21%)

1144 existing lines in 130 files now uncovered.

205692 of 307696 relevant lines covered (66.85%)

127112954.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

64.29
/source/libs/txnode/src/txnodeMgmt.c
1
/*
2
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
3
 *
4
 * This program is free software: you can use, redistribute, and/or modify
5
 * it under the terms of the GNU Affero General Public License, version 3
6
 * or later ("AGPL"), as published by the Free Software Foundation.
7
 *
8
 * This program is distributed in the hope that it will be useful, but WITHOUT
9
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
 * FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * You should have received a copy of the GNU Affero General Public License
13
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14
 */
15

16
// clang-format off
17
#include "uv.h"
18
#include "os.h"
19
#include "tarray.h"
20
#include "tglobal.h"
21
#include "txnode.h"
22
#include "txnodeInt.h"
23
#include "osString.h"
24

25
// clang-format on
26

27
extern char **environ;
28

29
#ifdef WINDOWS
30
#define XNODED_DEFAULT_PATH_1    "C:\\TDengine"
31
#define XNODED_DEFAULT_PATH_2    "C:\\TDengine"
32
#define XNODED_DEFAULT_EXEC_NAME "xnoded"
33
#define XNODED_DEFAULT_EXEC      "\\xnoded.exe"
34
#else
35
#define XNODED_DEFAULT_PATH_1    "/usr/bin"
36
#define XNODED_DEFAULT_PATH_2    "/usr/local/taos/bin"
37
#define XNODED_DEFAULT_EXEC_NAME "xnoded"
38
#define XNODED_DEFAULT_EXEC      "/xnoded"
39
#endif
40

41
#define XNODED_XNODED_PID_NAME ".xnoded.pid"
42

43
typedef struct {
44
  bool         isStarted;
45
  bool         needCleanUp;
46
  uv_loop_t    loop;
47
  uv_thread_t  thread;
48
  uv_barrier_t barrier;
49
  uv_process_t process;
50
  int32_t      spawnErr;
51
  uv_pipe_t    ctrlPipe;
52
  uv_async_t   stopAsync;
53
  int32_t      isStopped;
54
  int32_t      dnodeId;
55
  int64_t      clusterId;
56
  char         userPass[XNODE_USER_PASS_LEN];
57
  char         token[TSDB_TOKEN_LEN + 1];
58
  SEp          leaderEp;
59
} SXnodedData;
60

61
SXnodedData xnodedGlobal = {0};
62

63
static int32_t xnodeMgmtSpawnXnoded(SXnodedData *pData);
64

65
static void getXnodedPidPath(char *pipeName, int32_t size) {
444✔
66
#ifdef _WIN32
67
  snprintf(pipeName, size, "%s%s", tsDataDir, XNODED_XNODED_PID_NAME);
68
#else
69
  int32_t len = strlen(tsDataDir);
444✔
70
  if (len > 0 && tsDataDir[len - 1] != '/') {
444✔
71
    snprintf(pipeName, size, "%s/%s", tsDataDir, XNODED_XNODED_PID_NAME);
444✔
72
  } else {
NEW
73
    snprintf(pipeName, size, "%s%s", tsDataDir, XNODED_XNODED_PID_NAME);
×
74
  }
75
#endif
76
  xndDebug("xnode get xnoded pid path:%s", pipeName);
444✔
77
}
444✔
78

79
static void    xnodeMgmtXnodedExit(uv_process_t *process, int64_t exitStatus, int32_t termSignal) {
×
80
  TAOS_XNODED_MGMT_CHECK_PTR_RVOID(process);
×
81
  SXnodedData *pData = process->data;
×
NEW
82
  xndInfo("process xnoded exit with status %" PRId64 ", signal %d, isStopped:%d", exitStatus, termSignal,
×
83
          pData->isStopped);
84
  if (pData == NULL) {
×
85
    xndError("xnoded process data is NULL");
×
86
    return;
×
87
  }
NEW
88
  if ((exitStatus == 0 && (termSignal == 0 || termSignal == SIGINT || termSignal == SIGTERM)) ||
×
NEW
89
      atomic_load_32(&pData->isStopped)) {
×
90
    if (uv_async_send(&pData->stopAsync) != 0) {
×
91
      xndError("stop xnoded: failed to send stop async");
×
92
    }
93
    char xnodedPipeSocket[PATH_MAX] = {0};
×
94
    getXnodedPipeName(xnodedPipeSocket, PATH_MAX);
×
95
    if (0 != unlink(xnodedPipeSocket)) {
×
NEW
96
      xndWarn("txnode failed to unlink, socket: %s, err:%s", xnodedPipeSocket, terrstr());
×
97
    }
98

99
    char *pidPath = xnodedPipeSocket;
×
100
    memset(pidPath, 0, PATH_MAX);
×
101
    getXnodedPidPath(pidPath, PATH_MAX);
×
102
    (void)taosRemoveFile(pidPath);
×
NEW
103
    xndInfo("xnoded process exit success");
×
104
  } else {
105
    xndInfo("xnoded process restart, exit status %" PRId64 ", signal %d", exitStatus, termSignal);
×
106
    int32_t code = xnodeMgmtSpawnXnoded(pData);
×
107
    if (code != 0) {
×
108
      xndError("xnoded process restart failed with code:%d", code);
×
109
    }
NEW
110
    uv_sleep(500);
×
111
  }
112
}
113
void killPreXnoded() {
444✔
114
  char buf[PATH_MAX] = {0};
444✔
115
  getXnodedPidPath(buf, sizeof(buf));
444✔
116

117
  TdFilePtr pFile = NULL;
444✔
118
  pFile = taosOpenFile(buf, TD_FILE_READ);
444✔
119
  if (pFile == NULL) {
444✔
120
    xndWarn("xnode failed to open xnoded pid file:%s, file may not exist", buf);
444✔
121
    return;
444✔
122
  }
123
  int64_t readSize = taosReadFile(pFile, buf, sizeof(buf));
×
124
  if (readSize <= 0) {
×
125
    if (readSize < 0) {
×
126
      xndError("xnode failed to read len from file:%p since %s", pFile, terrstr());
×
127
    }
128
    (void)taosCloseFile(&pFile);
×
129
    return;
×
130
  }
131
  (void)taosCloseFile(&pFile);
×
132

133
  int32_t pid = taosStr2Int32(buf, NULL, 10);
×
134
  int result = uv_kill((uv_pid_t)pid, SIGTERM);
×
135
  if (result != 0) {
×
136
    if (result != UV_ESRCH) {
×
137
      xndError("xnode failed to kill process %d: %s", pid, uv_strerror(result));
×
138
    }
139
    return;
×
140
  }
141
}
142

143
void saveXnodedPid(int32_t pid) {
×
144
  char buf[PATH_MAX] = {0};
×
145
  getXnodedPidPath(buf, sizeof(buf));
×
146
  TdFilePtr testFilePtr = taosCreateFile(buf, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC);
×
147
  snprintf(buf, PATH_MAX, "%d", pid);
×
148
  (void)taosWriteFile(testFilePtr, buf, strlen(buf));
×
149
  (void)taosCloseFile(&testFilePtr);
×
150
}
×
151

152
static void locateXnodedExecFile(char *path) {
444✔
153
  if (tsProcPath == NULL) {
444✔
154
    path[0] = '.';
×
155
#ifdef WINDOWS
156
    GetModuleFileName(NULL, path, PATH_MAX);
157
#elif defined(_TD_DARWIN_64)
158
    uint32_t pathSize = sizeof(path);
159
    _NSGetExecutablePath(path, &pathSize);
160
#endif
161
  } else {
162
    TAOS_STRNCPY(path, tsProcPath, PATH_MAX);
444✔
163
  }
164

165
  TAOS_DIRNAME(path);
444✔
166
  if (strlen(path) != 0) {
444✔
167
    TAOS_STRCAT(path, XNODED_DEFAULT_EXEC);
444✔
168
    if (taosCheckExistFile(path)) {
444✔
169
      goto _ok;
×
170
    }
171
    xndDebug("can't find xnoded exec file:%s", path);
444✔
172
    path[0] = '\0';
444✔
173
  }
174

175
  TAOS_STRCAT(path, XNODED_DEFAULT_PATH_1);
444✔
176
  TAOS_STRCAT(path, XNODED_DEFAULT_EXEC);
444✔
177
  if (taosCheckExistFile(path)) {
444✔
178
    goto _ok;
×
179
  }
180
  xndDebug("can't find xnoded exec file:%s", path);
444✔
181
  path[0] = '\0';
444✔
182

183
  TAOS_STRCAT(path, XNODED_DEFAULT_PATH_2);
444✔
184
  TAOS_STRCAT(path, XNODED_DEFAULT_EXEC);
444✔
185
  if (taosCheckExistFile(path)) {
444✔
186
    goto _ok;
×
187
  }
188
  xndDebug("can't find xnoded exec file:%s", path);
444✔
189
  path[0] = '\0';
444✔
190

191
  path[0] = '.';
444✔
192
  path[1] = '\0';
444✔
193
  TAOS_STRCAT(path, XNODED_DEFAULT_EXEC);
444✔
194
  if (taosCheckExistFile(path)) {
444✔
195
    goto _ok;
×
196
  }
197
  xndDebug("can't find xnoded exec file:%s", path);
444✔
198
  path[0] = '\0';
444✔
199

200
  TAOS_STRNCPY(path, XNODED_DEFAULT_EXEC_NAME, PATH_MAX);
444✔
201
  xndInfo("can't find xnoded exec file, use default: %s", path);
444✔
202
  return;
444✔
203

204
_ok:
×
205
  xndInfo("find xnoded exec file:%s", path);
×
206
  return;
×
207
}
208

209
static int32_t xnodeMgmtSpawnXnoded(SXnodedData *pData) {
444✔
210
  xndDebug("start to init xnoded");
444✔
211
  TAOS_XNODED_MGMT_CHECK_PTR_RCODE(pData);
888✔
212

213
  int32_t              err = 0;
444✔
214
  uv_process_options_t options = {0};
444✔
215

216
  char path[PATH_MAX] = {0};
444✔
217
  locateXnodedExecFile(path);
444✔
218

219
  xndInfo("xnode mgmt spawn xnoded path: %s", path);
444✔
220
  // char *argsXnoded[] = {path, "-c", configDir, "-d", dnodeId, NULL};
221
  char *argsXnoded[] = {path, NULL};
444✔
222
  options.args = argsXnoded;
444✔
223
  options.file = path;
444✔
224

225
  options.exit_cb = xnodeMgmtXnodedExit;
444✔
226

227
  killPreXnoded();
444✔
228

229
  char xnodedPipeSocket[PATH_MAX] = {0};
444✔
230
  getXnodedPipeName(xnodedPipeSocket, PATH_MAX);
444✔
231
  if (0 != unlink(xnodedPipeSocket)) {
444✔
232
    xndWarn("txnode failed to unlink, ignore if first time, socket: %s, detail:%s", xnodedPipeSocket, terrstr());
444✔
233
  }
234

235
  TAOS_UV_LIB_ERROR_RET(uv_pipe_init(&pData->loop, &pData->ctrlPipe, 1));
444✔
236

237
  uv_stdio_container_t child_stdio[3];
444✔
238
  child_stdio[0].flags = UV_CREATE_PIPE | UV_READABLE_PIPE;
444✔
239
  child_stdio[0].data.stream = (uv_stream_t *)&pData->ctrlPipe;
444✔
240
  child_stdio[1].flags = UV_IGNORE;
444✔
241
  child_stdio[2].flags = UV_INHERIT_FD;
444✔
242
  child_stdio[2].data.fd = 2;
444✔
243
  options.stdio_count = 3;
444✔
244
  options.stdio = child_stdio;
444✔
245

246
  options.flags = UV_PROCESS_DETACHED;
444✔
247

248
  char xnodedCfgDir[PATH_MAX + 32] = {0};
444✔
249
  snprintf(xnodedCfgDir, PATH_MAX + 32, "%s=%s", "XNODED_CFG_DIR", configDir);
444✔
250
  char xnodedLogDir[PATH_MAX + 32] = {0};
444✔
251
  snprintf(xnodedLogDir, PATH_MAX + 32, "%s=%s", "XNODED_LOG_DIR", tsLogDir);
444✔
252
  char dnodeIdEnvItem[128] = {0};
444✔
253
  snprintf(dnodeIdEnvItem, 128, "%s=%s:%d", "XNODED_LEADER_EP", pData->leaderEp.fqdn, pData->leaderEp.port);
444✔
254
  char xnodedUserPass[XNODE_USER_PASS_LEN + 32] = {0};
444✔
255
  if (pData->userPass[0] != '\0') {
444✔
256
    snprintf(xnodedUserPass, XNODE_USER_PASS_LEN + 32, "%s=%s", "XNODED_USER_PASS", pData->userPass);
258✔
257
  }
258
  char xnodedToken[TSDB_TOKEN_LEN + 32] = {0};
444✔
259
  if (pData->token[0] != '\0') {
444✔
260
    snprintf(xnodedToken, TSDB_TOKEN_LEN + 32, "%s=%s", "XNODED_TOKEN", pData->token);
186✔
261
  }
262
  char xnodeClusterId[64] = {0};
444✔
263
  snprintf(xnodeClusterId, 64, "%s=%" PRIu64, "XNODED_CLUSTER_ID", pData->clusterId);
444✔
264
  char xnodePipeSocket[PATH_MAX + 32] = {0};
444✔
265
  snprintf(xnodePipeSocket, PATH_MAX + 32, "%s=%s", "XNODED_LISTEN", xnodedPipeSocket);
444✔
266

267
  char xnodedLogLevel[32] = {0};
444✔
268
  if (xndDebugFlag & DEBUG_INFO) {
444✔
269
    snprintf(xnodedLogLevel, 32, "%s=%s", "XNODED_LOG_LEVEL", "info");
444✔
270
  }
271
  if (xndDebugFlag & DEBUG_DEBUG) {
444✔
272
    snprintf(xnodedLogLevel, 32, "%s=%s", "XNODED_LOG_LEVEL", "debug");
×
273
  }
274
  if (xndDebugFlag & DEBUG_TRACE) {
444✔
275
    snprintf(xnodedLogLevel, 32, "%s=%s", "XNODED_LOG_LEVEL", "trace");
×
276
  }
277

278
  xndDebug("txnode env: leader ep: %s, pipe socket:%s, log level:%s, cluster_id: %s", dnodeIdEnvItem, xnodePipeSocket,
444✔
279
           xnodedLogLevel, xnodeClusterId);
280

281
  char *envXnoded[] = {xnodedCfgDir,    xnodedLogDir,   dnodeIdEnvItem,
444✔
282
                       xnodedUserPass,  xnodedToken,    xnodeClusterId,
283
                       xnodePipeSocket, xnodedLogLevel, NULL};
284

285
  char **envXnodedWithPEnv = NULL;
444✔
286
  if (environ != NULL) {
444✔
287
    int32_t lenEnvXnoded = ARRAY_SIZE(envXnoded);
444✔
288
    int32_t numEnviron = 0;
444✔
289
    while (environ[numEnviron] != NULL) {
13,764✔
290
      numEnviron++;
13,320✔
291
    }
292

293
    envXnodedWithPEnv = (char **)taosMemoryCalloc(numEnviron + lenEnvXnoded, sizeof(char *));
444✔
294
    if (envXnodedWithPEnv == NULL) {
444✔
295
      err = TSDB_CODE_OUT_OF_MEMORY;
×
296
      goto _OVER;
×
297
    }
298

299
    for (int32_t i = 0; i < numEnviron; i++) {
13,764✔
300
      int32_t len = strlen(environ[i]) + 1;
13,320✔
301
      xndDebug("xnoded exec env: %s", environ[i]);
13,320✔
302
      envXnodedWithPEnv[i] = (char *)taosMemoryCalloc(len, 1);
13,320✔
303
      if (envXnodedWithPEnv[i] == NULL) {
13,320✔
304
        err = TSDB_CODE_OUT_OF_MEMORY;
×
305
        goto _OVER;
×
306
      }
307

308
      tstrncpy(envXnodedWithPEnv[i], environ[i], len);
13,320✔
309
    }
310

311
    for (int32_t i = 0, j = 0; i < lenEnvXnoded; i++) {
4,440✔
312
      if (envXnoded[i] != NULL && envXnoded[i][0] != '\0') {
3,996✔
313
        int32_t len = strlen(envXnoded[i]) + 1;
3,108✔
314
        envXnodedWithPEnv[numEnviron + j] = (char *)taosMemoryCalloc(len, 1);
3,108✔
315
        if (envXnodedWithPEnv[numEnviron + j] == NULL) {
3,108✔
316
          err = TSDB_CODE_OUT_OF_MEMORY;
×
317
          goto _OVER;
×
318
        }
319
        tstrncpy(envXnodedWithPEnv[numEnviron + j], envXnoded[i], len);
3,108✔
320
        j++;
3,108✔
321
      } 
322
    }
323
    envXnodedWithPEnv[numEnviron + lenEnvXnoded - 1] = NULL;
444✔
324

325
    options.env = envXnodedWithPEnv;
444✔
326
  } else {
327
    options.env = envXnoded;
×
328
  }
329

330
  err = uv_spawn(&pData->loop, &pData->process, &options);
444✔
331
  pData->process.data = (void *)pData;
444✔
332
  if (err != 0) {
444✔
333
    xndError("can not spawn xnoded. path: %s, error: %s", path, uv_strerror(err));
444✔
334
  } else {
335
    xndInfo("xnoded is initialized, xnoded pid: %d", pData->process.pid);
×
336
    saveXnodedPid(pData->process.pid);
×
337
  }
338

339
_OVER:
444✔
340
  if (envXnodedWithPEnv != NULL) {
444✔
341
    int32_t i = 0;
444✔
342
    while (envXnodedWithPEnv[i] != NULL) {
16,872✔
343
      taosMemoryFree(envXnodedWithPEnv[i]);
16,428✔
344
      i++;
16,428✔
345
    }
346
    taosMemoryFree(envXnodedWithPEnv);
444✔
347
  }
348

349
  return err;
444✔
350
}
351

352
static void xnodeMgmtXnodedCloseWalkCb(uv_handle_t *handle, void *arg) {
×
353
  TAOS_XNODED_MGMT_CHECK_PTR_RVOID(handle);
×
354
  if (!uv_is_closing(handle)) {
×
NEW
355
    xndDebug("xnoded closing handle type:%d, ptr:%p", handle->type, handle);
×
UNCOV
356
    uv_close(handle, NULL);
×
357
  }
358
}
359

360
static void xnodeMgmtXnodedStopAsyncCb(uv_async_t *async) {
×
361
  TAOS_XNODED_MGMT_CHECK_PTR_RVOID(async);
×
362
  SXnodedData *pData = async->data;
×
363
  uv_stop(&pData->loop);
×
364
}
365

366
static void xnodeMgmtWatchXnoded(void *args) {
222✔
367
  TAOS_XNODED_MGMT_CHECK_PTR_RVOID(args);
444✔
368
  SXnodedData *pData = args;
222✔
369
  TAOS_UV_CHECK_ERRNO(uv_loop_init(&pData->loop));
222✔
370
  TAOS_UV_CHECK_ERRNO(uv_async_init(&pData->loop, &pData->stopAsync, xnodeMgmtXnodedStopAsyncCb));
222✔
371
  pData->stopAsync.data = pData;
222✔
372
  TAOS_UV_CHECK_ERRNO(xnodeMgmtSpawnXnoded(pData));
222✔
373
  atomic_store_32(&pData->spawnErr, 0);
×
374
  (void)uv_barrier_wait(&pData->barrier);
×
375
  int32_t num = uv_run(&pData->loop, UV_RUN_DEFAULT);
×
376
  xndInfo("xnoded loop exit with %d active handles, line:%d", num, __LINE__);
×
377

378
  uv_walk(&pData->loop, xnodeMgmtXnodedCloseWalkCb, NULL);
×
379
  num = uv_run(&pData->loop, UV_RUN_DEFAULT);
×
380
  xndInfo("xnoded loop exit with %d active handles, line:%d", num, __LINE__);
×
381
  if (uv_loop_close(&pData->loop) != 0) {
×
382
    xndError("xnoded loop close failed, lino:%d", __LINE__);
×
383
  }
384
  return;
×
385

386
_exit:
222✔
387
  if (terrno != 0) {
222✔
388
    (void)uv_barrier_wait(&pData->barrier);
222✔
389
    atomic_store_32(&pData->spawnErr, terrno);
222✔
390
    if (uv_loop_close(&pData->loop) != 0) {
222✔
391
      xndError("xnoded loop close failed, lino:%d", __LINE__);
222✔
392
    }
393

394
    xndError("xnoded thread exit with code:%d lino:%d", terrno, __LINE__);
222✔
395
    terrno = TSDB_CODE_XNODE_UV_EXEC_FAILURE;
222✔
396
  }
397
}
398

399
/**
400
 * start xnoded that serves xnode function invocation under dnode startDnodeId
401
 * @param startDnodeId
402
 * @return
403
 */
404
int32_t xnodeMgmtStartXnoded(SXnode *pXnode) {
780✔
405
  int32_t code = 0, lino = 0;
780✔
406

407
  SXnodedData *pData = &xnodedGlobal;
780✔
408
  pData->leaderEp = pXnode->ep;
780✔
409
  if (pData->isStarted) {
780✔
410
    xndInfo("dnode start xnoded already called");
558✔
411
    return 0;
558✔
412
  }
413
  pData->isStarted = true;
222✔
414
  char dnodeId[8] = {0};
222✔
415
  snprintf(dnodeId, sizeof(dnodeId), "%d", pXnode->dnodeId);
222✔
416
  TAOS_CHECK_GOTO(uv_os_setenv("DNODE_ID", dnodeId), &lino, _exit);
222✔
417
  pData->dnodeId = pXnode->dnodeId;
222✔
418
  pData->clusterId = pXnode->clusterId;
222✔
419
  memset(pData->userPass, 0, sizeof(pData->userPass));
222✔
420
  memcpy(pData->userPass, pXnode->userPass, pXnode->upLen);
222✔
421
  memset(pData->token, 0, sizeof(pData->token));
222✔
422
  memcpy(pData->token, pXnode->token, TSDB_TOKEN_LEN);
222✔
423

424
  TAOS_CHECK_GOTO(uv_barrier_init(&pData->barrier, 2), &lino, _exit);
222✔
425
  TAOS_CHECK_GOTO(uv_thread_create(&pData->thread, xnodeMgmtWatchXnoded, pData), &lino, _exit);
222✔
426
  (void)uv_barrier_wait(&pData->barrier);
222✔
427
  uv_sleep(100);
222✔
428
  int32_t err = atomic_load_32(&pData->spawnErr);
222✔
429
  if (err != 0) {
222✔
430
    uv_barrier_destroy(&pData->barrier);
222✔
431
    if (uv_async_send(&pData->stopAsync) != 0) {
222✔
432
      xndError("start xnoded: failed to send stop async");
×
433
    }
434
    if (uv_thread_join(&pData->thread) != 0) {
222✔
435
      xndError("start xnoded: failed to join xnoded thread");
×
436
    }
437
    pData->needCleanUp = false;
222✔
438
    xndInfo("xnoded is cleaned up after spawn err");
222✔
439
    TAOS_CHECK_GOTO(err, &lino, _exit);
222✔
440
  } else {
441
    pData->needCleanUp = true;
×
442
    atomic_store_32(&pData->isStopped, 0);
×
443
  }
444
_exit:
222✔
445
  if (code != 0) {
222✔
446
    xndError("xnoded start failed with lino:%d, code:%d, error: %s", code, lino, uv_strerror(code));
222✔
447
  }
448
  return code;
222✔
449
}
450
/**
451
 * stop xnoded
452
 * @return
453
 */
454
void xnodeMgmtStopXnoded(void) {
656,362✔
455
  SXnodedData *pData = &xnodedGlobal;
656,362✔
456
  xndInfo("stopping xnoded, need cleanup:%d, spawn err:%d, isStopped:%d", pData->needCleanUp, pData->spawnErr, atomic_load_32(&pData->isStopped));
656,362✔
457
  if (!pData->needCleanUp || atomic_load_32(&pData->isStopped)) {
656,362✔
458
    return;
656,362✔
459
  }
460
  atomic_store_32(&pData->isStopped, 1);
×
461
  pData->needCleanUp = false;
×
462
  (void)uv_process_kill(&pData->process, SIGTERM);
×
NEW
463
  uv_sleep(1000);
×
UNCOV
464
  uv_barrier_destroy(&pData->barrier);
×
465

NEW
466
  xndInfo("xnoded waiting to clean up");
×
467
  if (uv_thread_join(&pData->thread) != 0) {
×
468
    xndError("stop xnoded: failed to join xnoded thread");
×
469
  }
470
  xndInfo("xnoded is cleaned up");
×
471

472
  pData->isStarted = false;
×
473

474
  return;
×
475
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc