@cryptotaxi247 / netdata-1 / commits / 293969a27

Improve logging and packet handling for unknown packet IDs (#21099)

Stelios Fragkakis committed Oct 7, 2025 at 09:22 UTC 293969a27e340fc9cf7bf2df1ae98a03e29bcc1d
1 file changed +3 -2
src/aclk/mqtt_websockets/mqtt_ng.c
+3 -2
@@ -823,7 +823,7 @@ static int optimized_add(struct header_buffer *buf, void *data, size_t data_len,
823 static void remove_packet_from_timeout_monitor_list_unsafe(struct mqtt_ng_client *client, uint16_t packet_id)
824 {
825 int rc = JudyLDel(&client->pending_packets.JudyL, (Word_t) packet_id, PJE0);
826 - // rc = 1 if the packer was deleted, so update statistics
826 + // rc = 1 if the packet was deleted, so update statistics
827 if (likely(rc))
828 __atomic_fetch_sub(&client->stats.packets_waiting_puback, 1, __ATOMIC_RELAXED);
829 }
@@ -1213,8 +1213,9 @@ static int mark_packet_acked(struct mqtt_ng_client *client, uint16_t packet_id)
1213
1214 frag = frag->next;
1215 }
1216 - nd_log(NDLS_DAEMON, NDLP_ERR, "Received packet_id (%" PRIu16 ") is unknown!", packet_id);
1216 + nd_log(NDLS_DAEMON, NDLP_WARNING, "Received packet_id (%" PRIu16 ") is unknown, removing from monitor list", packet_id);
1217 UNLOCK_HDR_BUFFER(&client->main_buffer);
1218 + remove_packet_from_timeout_monitor_list_unsafe(client, packet_id);
1219 spinlock_unlock(&client->pending_packets.spinlock);
1220 return 1;
1221 }