fix: call closeFunc when it is not nullptr
This commit is contained in:
parent
7ec5a5df3a
commit
a7888257d7
|
@ -33,7 +33,6 @@
|
|||
#define MAX_NUM_SCRIPT_PLUGINS 64
|
||||
#define MAX_NUM_PLUGIN_FUNCS 9
|
||||
|
||||
|
||||
typedef struct SUdfCPluginCtx {
|
||||
uv_lib_t lib;
|
||||
|
||||
|
@ -347,14 +346,14 @@ void udfdInitializePythonPlugin(SUdfScriptPlugin *plugin) {
|
|||
return;
|
||||
}
|
||||
if (plugin->openFunc) {
|
||||
int16_t lenPythonPath = strlen(tsUdfdLdLibPath) + strlen(tsTempDir) + 1 + 1; //tsTempDir:tsUdfdLdLibPath
|
||||
char* pythonPath= taosMemoryMalloc(lenPythonPath);
|
||||
#ifdef WINDOWS
|
||||
int16_t lenPythonPath = strlen(tsUdfdLdLibPath) + strlen(tsTempDir) + 1 + 1; // tsTempDir:tsUdfdLdLibPath
|
||||
char *pythonPath = taosMemoryMalloc(lenPythonPath);
|
||||
#ifdef WINDOWS
|
||||
snprintf(pythonPath, lenPythonPath, "%s;%s", tsTempDir, tsUdfdLdLibPath);
|
||||
#else
|
||||
#else
|
||||
snprintf(pythonPath, lenPythonPath, "%s:%s", tsTempDir, tsUdfdLdLibPath);
|
||||
#endif
|
||||
SScriptUdfEnvItem items[] ={{"PYTHONPATH", pythonPath}};
|
||||
#endif
|
||||
SScriptUdfEnvItem items[] = {{"PYTHONPATH", pythonPath}};
|
||||
plugin->openFunc(items, 1);
|
||||
taosMemoryFree(pythonPath);
|
||||
}
|
||||
|
@ -379,7 +378,9 @@ void udfdDeinitCPlugin(SUdfScriptPlugin *plugin) {
|
|||
}
|
||||
|
||||
void udfdDeinitPythonPlugin(SUdfScriptPlugin *plugin) {
|
||||
if (plugin->closeFunc) {
|
||||
plugin->closeFunc();
|
||||
}
|
||||
uv_dlclose(&plugin->lib);
|
||||
if (plugin->libLoaded) {
|
||||
plugin->libLoaded = false;
|
||||
|
@ -422,7 +423,6 @@ void udfdDeinitScriptPlugins() {
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void udfdProcessRequest(uv_work_t *req) {
|
||||
SUvUdfWork *uvUdf = (SUvUdfWork *)(req->data);
|
||||
SUdfRequest request = {0};
|
||||
|
@ -469,7 +469,7 @@ int32_t udfdInitUdf(char *udfName, SUdf *udf) {
|
|||
fnError("can not retrieve udf from mnode. udf name %s", udfName);
|
||||
return TSDB_CODE_UDF_LOAD_UDF_FAILURE;
|
||||
}
|
||||
//TODO: remove script plugins mutex
|
||||
// TODO: remove script plugins mutex
|
||||
uv_mutex_lock(&global.scriptPluginsMutex);
|
||||
SUdfScriptPlugin *scriptPlugin = global.scriptPlugins[udf->scriptType];
|
||||
if (scriptPlugin == NULL) {
|
||||
|
@ -766,11 +766,11 @@ void udfdProcessRpcRsp(void *parent, SRpcMsg *pMsg, SEpSet *pEpSet) {
|
|||
}
|
||||
|
||||
char path[PATH_MAX] = {0};
|
||||
#ifdef WINDOWS
|
||||
#ifdef WINDOWS
|
||||
snprintf(path, sizeof(path), "%s%s", tsTempDir, pFuncInfo->name);
|
||||
#else
|
||||
#else
|
||||
snprintf(path, sizeof(path), "%s/%s", tsTempDir, pFuncInfo->name);
|
||||
#endif
|
||||
#endif
|
||||
TdFilePtr file = taosOpenFile(path, TD_FILE_CREATE | TD_FILE_WRITE | TD_FILE_READ | TD_FILE_TRUNC);
|
||||
if (file == NULL) {
|
||||
fnError("udfd write udf shared library: %s failed, error: %d %s", path, errno, strerror(errno));
|
||||
|
|
Loading…
Reference in New Issue