From 8dac5a52bb0e14320fa8fe4a24b9af4fc419fad1 Mon Sep 17 00:00:00 2001 From: Costa Tsaousis Date: Thu, 21 Dec 2023 17:21:56 +0200 Subject: [PATCH] increase max response size to 100MiB (#16649) * increase max response size to 100MiB * do not check the uncompressed message size on aclk --- aclk/aclk_query.c | 8 -------- aclk/aclk_tx_msgs.c | 4 ++-- collectors/plugins.d/pluginsd_parser.h | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c index ee053d9e676bca..1f2ec864c8c85a 100644 --- a/aclk/aclk_query.c +++ b/aclk/aclk_query.c @@ -6,7 +6,6 @@ #include "../../web/server/web_client_cache.h" #define WEB_HDR_ACCEPT_ENC "Accept-Encoding:" -#define ACLK_MAX_WEB_RESPONSE_SIZE (30 * 1024 * 1024) pthread_cond_t query_cond_wait = PTHREAD_COND_INITIALIZER; pthread_mutex_t query_lock_wait = PTHREAD_MUTEX_INITIALIZER; @@ -137,13 +136,6 @@ static int http_api_v2(struct aclk_query_thread *query_thr, aclk_query_t query) w->response.code = (short)web_client_api_request_with_node_selection(localhost, w, path); web_client_timeout_checkpoint_response_ready(w, &t); - if(buffer_strlen(w->response.data) > ACLK_MAX_WEB_RESPONSE_SIZE) { - buffer_flush(w->response.data); - buffer_strcat(w->response.data, "response is too big"); - w->response.data->content_type = CT_TEXT_PLAIN; - w->response.code = HTTP_RESP_CONTENT_TOO_LONG; - } - if (aclk_stats_enabled) { ACLK_STATS_LOCK; aclk_metrics_per_sample.cloud_q_process_total += t; diff --git a/aclk/aclk_tx_msgs.c b/aclk/aclk_tx_msgs.c index 4102c818d39ee1..0e4182a7291011 100644 --- a/aclk/aclk_tx_msgs.c +++ b/aclk/aclk_tx_msgs.c @@ -86,7 +86,7 @@ static int aclk_send_message_with_bin_payload(mqtt_wss_client client, json_objec int rc = mqtt_wss_publish5(client, (char*)topic, NULL, full_msg, &freez_aclk_publish5b, full_msg_len, MQTT_WSS_PUB_QOS1, &packet_id); if (rc == MQTT_WSS_ERR_TOO_BIG_FOR_SERVER) - return HTTP_RESP_FORBIDDEN; + return HTTP_RESP_CONTENT_TOO_LONG; #ifdef NETDATA_INTERNAL_CHECKS aclk_stats_msg_published(packet_id); @@ -194,7 +194,7 @@ int aclk_http_msg_v2(mqtt_wss_client client, const char *topic, const char *msg_ int rc = aclk_send_message_with_bin_payload(client, msg, topic, payload, payload_len); switch (rc) { - case HTTP_RESP_FORBIDDEN: + case HTTP_RESP_CONTENT_TOO_LONG: aclk_http_msg_v2_err(client, topic, msg_id, rc, CLOUD_EC_REQ_REPLY_TOO_BIG, CLOUD_EMSG_REQ_REPLY_TOO_BIG, NULL, 0); break; case HTTP_RESP_INTERNAL_SERVER_ERROR: diff --git a/collectors/plugins.d/pluginsd_parser.h b/collectors/plugins.d/pluginsd_parser.h index cae7560fed40f8..7b1002f136557c 100644 --- a/collectors/plugins.d/pluginsd_parser.h +++ b/collectors/plugins.d/pluginsd_parser.h @@ -11,7 +11,7 @@ #define WORKER_RECEIVER_JOB_REPLICATION_COMPLETION (WORKER_PARSER_FIRST_JOB - 3) // this controls the max response size of a function -#define PLUGINSD_MAX_DEFERRED_SIZE (20 * 1024 * 1024) +#define PLUGINSD_MAX_DEFERRED_SIZE (100 * 1024 * 1024) #define PLUGINSD_MIN_RRDSET_POINTERS_CACHE 1024