Exercise normalizer waiter allocation failure on a busy ETCP queue

This commit is contained in:
evgeny committed 2026-10-23 12:30:38 +02:00
1 parent 6e33675503
commit f221fa5a89
1 file changed
+8 -1
+8 -1
View File
@@ -75,6 +75,7 @@ struct ll_entry* __wrap_ll_alloc_lldgram(uint16_t len) {
void* __real_u_malloc_impl(uint32_t, const char*);
void* __wrap_u_malloc_impl(uint32_t size, const char* where) {
if (no_alloc) { unexpected_alloc++; return NULL; }
if (fail_normalizer_waiter && strstr(where, "ll_queue.c:")) { fail_normalizer_waiter--; return NULL; }
return __real_u_malloc_impl(size, where);
}
void* __real_u_calloc_impl(uint32_t, uint32_t, const char*);
@@ -755,9 +756,15 @@ static void normalizer_tx_oom(void) {
if (fault == 1) fail_rx_fragment = 1;
if (fault == 2) fail_tx_inflight = 1;
if (fault == 3) fail_normalizer_timer = 1;
if (fault == 4) fail_normalizer_waiter = 1;
if (fault == 4) {
conn->input_queue->callback_suspended = 1;
struct ll_entry* busy = ll_alloc_lldgram(1); CHECK(busy); busy->len = 1;
CHECK(queue_data_put(conn->input_queue, busy) == 0); fail_normalizer_waiter = 1;
}
if (fault == 5) queue_set_size_limit(conn->input_queue, 0);
CHECK(etcp_send(conn, entry) == 0); uasync_drain_immediate(ua);
DEBUG_INFO(DEBUG_CATEGORY_DEBUG, "Normalizer TX fault=%u reset=%u pending=%u timer=%d DATA_sends=%u",
fault, conn->reset_count, conn->reinit_pending, !!conn->session_timer, sends);
CHECK(conn->reset_id != epoch && conn->reinit_pending && conn->session_timer);
CHECK(!conn->unacked_bytes && !conn->active_attempts && !conn->input_queue->count && !sends);
CHECK(!conn->normalizer->input->count && !conn->normalizer->data && !conn->normalizer->flush_timer);