fix:Deadlock caused by assert modification

This commit is contained in:
facetosea 2023-01-06 10:43:47 +08:00
parent 77bbbdc776
commit 61734b9c6a
2 changed files with 9 additions and 3 deletions

View File

@ -368,6 +368,9 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1; return -1;
} }
int64_t leftbytes = count; int64_t leftbytes = count;
@ -415,6 +418,9 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1; return -1;
} }
#ifdef WINDOWS #ifdef WINDOWS
@ -479,6 +485,9 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return 0; return 0;
} }
#ifdef WINDOWS #ifdef WINDOWS

View File

@ -716,9 +716,6 @@ void putBackAutoPtr(int type, STire* tire) {
} else { } else {
tires[type]->ref--; tires[type]->ref--;
ASSERT(tires[type]->ref > 0); ASSERT(tires[type]->ref > 0);
if (tires[type]->ref <= 0) {
return;
}
} }
taosThreadMutexUnlock(&tiresMutex); taosThreadMutexUnlock(&tiresMutex);