From 7da0f72179fcfbde17efbf2cabe7a26c8f484c92 Mon Sep 17 00:00:00 2001 From: hwwang Date: Fri, 29 Nov 2024 09:43:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E4=BA=8E=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=97=B6=E9=97=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/include/sandbox_request.h | 20 +++++++++++++++++++- runtime/src/current_sandbox.c | 2 +- runtime/src/sandbox.c | 12 ------------ runtime/src/software_interrupt.c | 3 +-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/runtime/include/sandbox_request.h b/runtime/include/sandbox_request.h index 0f0a035..ab4a50a 100644 --- a/runtime/include/sandbox_request.h +++ b/runtime/include/sandbox_request.h @@ -179,6 +179,10 @@ pre_functions_output_request_add(struct sandbox_request *request, char *output, **/ static inline void concatenate_outputs(struct sandbox_request *request) { + if(request->pre_functions_output == NULL) { + return; + } + size_t total_length = 0; // Calculate total length without extra for null character struct sandbox_pre_functions_output *current = request->pre_functions_output; @@ -229,5 +233,19 @@ concatenate_outputs(struct sandbox_request *request) { request->previous_function_output = NULL; } request->output_length = total_length; - request->previous_function_output = concatenated_output; + request->previous_function_output = concatenated_output; + + /**/ + if (request->pre_functions_output != NULL) + { + struct sandbox_pre_functions_output *current = request->pre_functions_output; + struct sandbox_pre_functions_output *next = NULL; + while (current) { + next = current->next; + free(current->previous_function_output); + free(current); + current = next; } + request->pre_functions_output = NULL; + } + pthread_spin_destroy(&request->lock); } diff --git a/runtime/src/current_sandbox.c b/runtime/src/current_sandbox.c index d2d20f2..ba44944 100644 --- a/runtime/src/current_sandbox.c +++ b/runtime/src/current_sandbox.c @@ -375,7 +375,7 @@ current_sandbox_start(void) goto err; }; - http_total_increment_2xx(); + //http_total_increment_2xx(); sandbox->response_timestamp = __getcycles(); diff --git a/runtime/src/sandbox.c b/runtime/src/sandbox.c index d410924..1684149 100644 --- a/runtime/src/sandbox.c +++ b/runtime/src/sandbox.c @@ -151,18 +151,6 @@ sandbox_allocate(struct sandbox_request *sandbox_request) /* Set state to initializing */ sandbox_set_as_initialized(sandbox, sandbox_request, now); - if (sandbox_request->pre_functions_output != NULL) - { - struct sandbox_pre_functions_output *current = sandbox_request->pre_functions_output; - struct sandbox_pre_functions_output *next = NULL; - while (current) { - next = current->next; - free(current->previous_function_output); - free(current); - current = next; } - sandbox_request->pre_functions_output = NULL; - } - pthread_spin_destroy(&sandbox_request->lock); free(sandbox_request); done: return sandbox; diff --git a/runtime/src/software_interrupt.c b/runtime/src/software_interrupt.c index 9b3e2ef..1148072 100644 --- a/runtime/src/software_interrupt.c +++ b/runtime/src/software_interrupt.c @@ -266,10 +266,9 @@ software_interrupt_arm_timer(void) /* if preemption disabled, broadcast sig alarm to all other threads to record the queuelength info */ if (!runtime_preemption_enabled) { runtime_sigalrm_handler = RUNTIME_SIGALRM_HANDLER_BROADCAST; + return; } - if (!runtime_preemption_enabled) return; - struct itimerval interval_timer; memset(&interval_timer, 0, sizeof(struct itimerval));