From 3aa13025c2e2b68741033498626f5fa7e32c5062 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 12 Dec 2022 21:57:52 +0800 Subject: [PATCH] fix: udfd without copy buf again and udfd read eof not log with error --- source/libs/function/src/udfd.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/libs/function/src/udfd.c b/source/libs/function/src/udfd.c index 9ee9c787ee..af0c27a89f 100644 --- a/source/libs/function/src/udfd.c +++ b/source/libs/function/src/udfd.c @@ -764,10 +764,8 @@ bool isUdfdUvMsgComplete(SUdfdUvConn *pipe) { } void udfdHandleRequest(SUdfdUvConn *conn) { - char *inputBuf = taosMemoryMalloc(conn->inputLen); - memcpy(inputBuf, conn->inputBuf, conn->inputLen); + char *inputBuf = conn->inputBuf; int32_t inputLen = conn->inputLen; - taosMemoryFree(conn->inputBuf); uv_work_t *work = taosMemoryMalloc(sizeof(uv_work_t)); SUvUdfWork *udfWork = taosMemoryMalloc(sizeof(SUvUdfWork)); @@ -797,7 +795,7 @@ void udfdPipeCloseCb(uv_handle_t *pipe) { } void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { - fnDebug("udf read %zd bytes from client", nread); + fnDebug("udfd read %zd bytes from client", nread); if (nread == 0) return; SUdfdUvConn *conn = client->data; @@ -813,10 +811,10 @@ void udfdPipeRead(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { } if (nread < 0) { - fnError("Receive error %s", uv_err_name(nread)); if (nread == UV_EOF) { - // TODO check more when close + fnError("udfd read EOF"); } else { + fnError("Receive error %s", uv_err_name(nread)); } udfdUvHandleError(conn); } -- GitLab