fix: on windows, closing a JDBC PreparedStatement while writing data may cause the JVM to crash.
This commit is contained in:
parent
3b36b48551
commit
a3b042c078
|
@ -1630,6 +1630,7 @@ int stmtClose(TAOS_STMT* stmt) {
|
|||
|
||||
STMT_DLOG_E("start to free stmt");
|
||||
|
||||
if (pStmt->bindThreadInUse) {
|
||||
pStmt->queue.stopQueue = true;
|
||||
|
||||
(void)taosThreadMutexLock(&pStmt->queue.mutex);
|
||||
|
@ -1637,13 +1638,12 @@ int stmtClose(TAOS_STMT* stmt) {
|
|||
(void)taosThreadCondSignal(&(pStmt->queue.waitCond));
|
||||
(void)taosThreadMutexUnlock(&pStmt->queue.mutex);
|
||||
|
||||
if (pStmt->bindThreadInUse) {
|
||||
(void)taosThreadJoin(pStmt->bindThread, NULL);
|
||||
pStmt->bindThreadInUse = false;
|
||||
}
|
||||
|
||||
(void)taosThreadCondDestroy(&pStmt->queue.waitCond);
|
||||
(void)taosThreadMutexDestroy(&pStmt->queue.mutex);
|
||||
}
|
||||
|
||||
STMT_DLOG("stmt %p closed, stbInterlaceMode: %d, statInfo: ctgGetTbMetaNum=>%" PRId64 ", getCacheTbInfo=>%" PRId64
|
||||
", parseSqlNum=>%" PRId64 ", pStmt->stat.bindDataNum=>%" PRId64
|
||||
|
|
|
@ -1768,18 +1768,18 @@ int stmtClose2(TAOS_STMT2* stmt) {
|
|||
|
||||
pStmt->queue.stopQueue = true;
|
||||
|
||||
if (pStmt->bindThreadInUse) {
|
||||
(void)taosThreadMutexLock(&pStmt->queue.mutex);
|
||||
(void)atomic_add_fetch_64(&pStmt->queue.qRemainNum, 1);
|
||||
(void)taosThreadCondSignal(&(pStmt->queue.waitCond));
|
||||
(void)taosThreadMutexUnlock(&pStmt->queue.mutex);
|
||||
|
||||
if (pStmt->bindThreadInUse) {
|
||||
(void)taosThreadJoin(pStmt->bindThread, NULL);
|
||||
pStmt->bindThreadInUse = false;
|
||||
}
|
||||
|
||||
(void)taosThreadCondDestroy(&pStmt->queue.waitCond);
|
||||
(void)taosThreadMutexDestroy(&pStmt->queue.mutex);
|
||||
}
|
||||
|
||||
if (pStmt->options.asyncExecFn && !pStmt->semWaited) {
|
||||
if (tsem_wait(&pStmt->asyncQuerySem) != 0) {
|
||||
|
|
Loading…
Reference in New Issue