diff --git a/src/core/lib/resource_quota/memory_quota.cc b/src/core/lib/resource_quota/memory_quota.cc index f94ffb319446f..c72c09e9638e4 100644 --- a/src/core/lib/resource_quota/memory_quota.cc +++ b/src/core/lib/resource_quota/memory_quota.cc @@ -376,7 +376,7 @@ void BasicMemoryQuota::Take(size_t amount) { auto prior = free_bytes_.fetch_sub(amount, std::memory_order_acq_rel); // If we push into overcommit, awake the reclaimer. if (prior >= 0 && prior < static_cast(amount)) { - reclaimer_activity_->ForceWakeup(); + if (reclaimer_activity_ != nullptr) reclaimer_activity_->ForceWakeup(); } } diff --git a/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk b/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk new file mode 100644 index 0000000000000..e3df978476131 --- /dev/null +++ b/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk @@ -0,0 +1,1601 @@ +actions { + quota: 2 + create_quota { + } +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + set_quota_size: 171798691840 +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 +} +actions { + quota: 2 + allocator: -1610612735 + create_allocator { + } +} +actions { + quota: -1610612735 + allocation: 7 +} +actions { + quota: 2 + allocator: 10682370 + create_allocator { + } +} +actions { + quota: 2 + allocation: 3 + create_allocator { + } +} +actions { + allocator: 44 + allocation: 2 + flush_exec_ctx { + } +} +actions { + quota: 2 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + post_reclaimer { + pass: DESTRUCTIVE + } +} +actions { +} +actions { + quota: 2 + allocator: 2 +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 44 + delete_quota { + } +} +actions { + allocation: 2 +} +actions { + rebind_quota { + } +} +actions { + quota: 2 + allocator: 45 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + flush_exec_ctx { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + set_quota_size: 0 +} +actions { + quota: 2 + allocator: 44 + allocation: 2 +} +actions { + quota: 2 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: -2147483641 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + rebind_quota { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + create_quota { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocation: 2 +} +actions { + quota: 44 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + rebind_quota { + } +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 7 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 42 +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2097152 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 44 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + set_quota_size: 171790 +} +actions { + quota: 2 + allocator: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 140 + create_allocator { + } +} +actions { + allocation: 2 + create_allocator { + } +} +actions { + quota: 67108864 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + delete_quota { + } +} +actions { +} +actions { + quota: 10 + allocator: 2 + delete_allocator { + } +} +actions { + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 45 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + flush_exec_ctx { + } +} +actions { + quota: 2097152 + allocation: 2 +} +actions { + create_quota { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 +} +actions { + quota: 2 + allocation: 2 +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + create_quota { + } +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + allocation: 7 +} +actions { + quota: 2 + allocator: 44 + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 2 +} +actions { + quota: 6 +} +actions { + quota: 45 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 2 + create_allocator { + } +} +actions { + quota: 67108864 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + delete_allocator { + } +} +actions { + quota: 2 +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 44 + allocation: 15 + create_allocator { + } +} +actions { +} +actions { + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delte_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocation { + max: 788529152 + } +} +actions { + quota: 2 + allocator: 131200 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: -9437190 + rebind_quota { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocation { + max: 1936942413 + } +} +actions { + create_allocation { + } +} +actions { + quota: 2 + allocator: 2 + set_quota_size: 171798691840 +} +actions { + quota: 2 + allocator: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 140 + create_allocator { + } +} +actions { + allocator: 262144 + allocation: 2 + create_allocator { + } +} +actions { + quota: 67108864 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 2 +} +actions { + quota: 10 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 45 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 2304 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 2 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + allocation: 44 + delete_allocator { + } +} +actions { + quota: 2097152 + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 262188 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + rebind_quota { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + rebind_quota { + } +} +actions { + quota: 2 + allocation: 2 +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + allocator: 7610368 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + rebind_quota { + } +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { + quota: 8704 + create_allocator { + } +} +actions { + quota: 2 + allocation: 7 + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2567 +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + delete_allocator { + } +} +actions { + allocation: 2 +} +actions { + create_allocator { + } +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 +} +actions { + quota: 2 + allocator: 8704 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 2 + create_quota { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 2 + create_allocator { + } +} +actions { + quota: 67108864 +} +actions { + quota: 2 + allocator: 2 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocator: 2 + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + create_allocator { + } +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocator: 7 + create_allocator { + } +} +actions { + allocation: 2 +} +actions { +} +actions { + quota: 2 + allocator: 44 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + delete_allocator { + } +} +actions { + quota: 2 + allocator: 7 + allocation: 2 + create_allocator { + } +} +actions { +} +actions { + quota: 2 + allocation: 2 + create_allocator { + } +} +actions { + allocation: 2 +} +actions { + allocation: 2 + delete_allocator { + } +} + diff --git a/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk-after-creduce b/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk-after-creduce new file mode 100644 index 0000000000000..f941e8a7f29f6 --- /dev/null +++ b/test/core/resource_quota/memory_quota_fuzzer_corpus/testcase-replenish-nullchk-after-creduce @@ -0,0 +1,15 @@ +actions { + create_quota {} +} +actions { + create_allocator {} +} +actions{set_quota_size : 790} actions { + delete_quota {} +} +actions { + create_allocation { + max: + 2 + } +}