mirror of https://github.com/grpc/grpc.git
Change reclaimer function signature (#27649)
* Fix fuzzer found leak in memory_quota * Make reclamation functions know about cancellation * fixes * fix race * Automated change: Fix sanity tests * fixes * Automated change: Fix sanity tests Co-authored-by: ctiller <ctiller@users.noreply.github.com>pull/27659/head
parent
6f2021c48f
commit
016ef6cede
10 changed files with 1020 additions and 42 deletions
@ -0,0 +1,52 @@ |
||||
// Copyright 2021 gRPC authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef LOCAL_GOOGLE_HOME_CTILLER_GRPC_TEST_CORE_RESOURCE_QUOTA_CALL_CHECKER_H_ |
||||
#define LOCAL_GOOGLE_HOME_CTILLER_GRPC_TEST_CORE_RESOURCE_QUOTA_CALL_CHECKER_H_ |
||||
|
||||
#include <memory> |
||||
|
||||
#include <grpc/support/log.h> |
||||
|
||||
namespace grpc_core { |
||||
namespace testing { |
||||
|
||||
// Utility to help check a function is called.
|
||||
// Usage:
|
||||
// auto checker = CallChecker::Make();
|
||||
// auto f = [checker]() {
|
||||
// checker.Called();
|
||||
// };
|
||||
// Will crash if: f never called, or f called more than once.
|
||||
class CallChecker { |
||||
public: |
||||
~CallChecker() { GPR_ASSERT(called_); } |
||||
|
||||
void Called() { |
||||
GPR_ASSERT(!called_); |
||||
called_ = true; |
||||
} |
||||
|
||||
static std::shared_ptr<CallChecker> Make() { |
||||
return std::make_shared<CallChecker>(); |
||||
} |
||||
|
||||
private: |
||||
bool called_ = false; |
||||
}; |
||||
|
||||
} // namespace testing
|
||||
} // namespace grpc_core
|
||||
|
||||
#endif // LOCAL_GOOGLE_HOME_CTILLER_GRPC_TEST_CORE_RESOURCE_QUOTA_CALL_CHECKER_H_
|
@ -0,0 +1,859 @@ |
||||
actions { |
||||
quota: 7496448 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2162720 |
||||
create_quota { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 144 |
||||
allocation: 4225395 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 8 |
||||
} |
||||
actions { |
||||
quota: 262152 |
||||
allocator: 117440513 |
||||
allocation: 6 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
allocator: 175972352 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
} |
||||
actions { |
||||
quota: 2049 |
||||
allocator: 2048 |
||||
allocation: 3 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 16713728 |
||||
allocator: 2048 |
||||
} |
||||
actions { |
||||
allocator: 30768 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 117440513 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
allocation: 9459968 |
||||
} |
||||
actions { |
||||
allocator: 6 |
||||
allocation: -65536 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 218103807 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
} |
||||
actions { |
||||
quota: 6 |
||||
allocator: 6 |
||||
allocation: 3 |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2162720 |
||||
allocator: 1 |
||||
allocation: 9437184 |
||||
delete_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: -196608 |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
set_quota_size: 2785017856 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 117440513 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: -196608 |
||||
create_allocation { |
||||
max: 1986199552 |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
allocation: 256 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 117440513 |
||||
allocation: 9437184 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 507 |
||||
allocation: -65536 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 28416 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 65543 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: -196608 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 6 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 1 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2099835 |
||||
allocation: 9437184 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: -2 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 1 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2099488 |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 61295 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 117440513 |
||||
allocation: 9437184 |
||||
set_quota_size: 2785017856 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 9437184 |
||||
} |
||||
actions { |
||||
quota: -5 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 117440513 |
||||
allocation: 9437184 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 111 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 4 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 6 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 16775680 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 117440513 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: -196608 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 65 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 3 |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
allocation: 1862299392 |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 3 |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
set_quota_size: 0 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
allocator: -256 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
quota: 536832 |
||||
allocator: 117440513 |
||||
allocation: 9437184 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: -9671427 |
||||
create_allocation { |
||||
max: 1024 |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 28416 |
||||
allocation: 12544 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: -5 |
||||
allocator: 2048 |
||||
allocation: 9437184 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: -196608 |
||||
allocation: -196608 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
post_reclaimer { |
||||
msg { |
||||
actions { |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
allocator: 4 |
||||
allocation: 536870912 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: -5 |
||||
allocation: 65 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 4259840 |
||||
allocator: -5 |
||||
allocation: 771763712 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 2048 |
||||
post_reclaimer { |
||||
pass: DESTRUCTIVE |
||||
msg { |
||||
actions { |
||||
} |
||||
actions { |
||||
allocation: 65 |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2 |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 3 |
||||
} |
||||
actions { |
||||
allocation: 2048 |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
allocation: 9437184 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: -196608 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 8 |
||||
allocation: 9437184 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 301989889 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 2048 |
||||
allocation: 9437184 |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
allocator: 117440513 |
||||
allocation: -1869611008 |
||||
create_allocation { |
||||
max: 1986199552 |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
} |
||||
actions { |
||||
allocator: 111 |
||||
flush_exec_ctx { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 9437184 |
||||
allocator: 4 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 16779008 |
||||
allocation: 6 |
||||
rebind_quota { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 79 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 2048 |
||||
set_quota_size: 16646144 |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 12544 |
||||
create_allocator { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 1792 |
||||
allocation: 9437184 |
||||
} |
||||
actions { |
||||
quota: 65 |
||||
allocator: 6 |
||||
allocation: -196608 |
||||
post_reclaimer { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 6 |
||||
allocation: 2048 |
||||
post_reclaimer { |
||||
msg { |
||||
actions { |
||||
create_quota { |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 111 |
||||
allocation: 536870912 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: -5 |
||||
allocation: 2048 |
||||
} |
||||
actions { |
||||
quota: 4259840 |
||||
allocator: -5 |
||||
allocation: 65 |
||||
create_allocation { |
||||
min: 32 |
||||
max: 32 |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 2048 |
||||
post_reclaimer { |
||||
pass: DESTRUCTIVE |
||||
msg { |
||||
actions { |
||||
} |
||||
actions { |
||||
allocation: 65 |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 908081664 |
||||
delete_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 111 |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
post_reclaimer { |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 3 |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
allocation: 1862299392 |
||||
create_allocation { |
||||
max: 32 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
delete_quota { |
||||
} |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
allocation: 111 |
||||
set_quota_size: 0 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocation: 3 |
||||
} |
||||
actions { |
||||
post_reclaimer { |
||||
pass: IDLE |
||||
msg { |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
set_quota_size: 0 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 61295 |
||||
} |
||||
actions { |
||||
create_allocation { |
||||
max: 14624 |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
actions { |
||||
} |
||||
actions { |
||||
quota: 204 |
||||
create_allocation { |
||||
max: 1 |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 111 |
||||
allocation: 9437184 |
||||
create_allocation { |
||||
max: 3 |
||||
} |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 111 |
||||
flush_exec_ctx { |
||||
} |
||||
} |
||||
actions { |
||||
allocator: 111 |
||||
create_quota { |
||||
} |
||||
} |
||||
actions { |
||||
quota: 9437184 |
||||
} |
||||
actions { |
||||
quota: 2048 |
||||
allocator: 16779008 |
||||
allocation: -7706983 |
||||
create_allocator { |
||||
} |
||||
} |
||||
|
@ -0,0 +1,9 @@ |
||||
actions { |
||||
create_quota {} |
||||
} |
||||
actions { |
||||
create_allocator {} |
||||
} |
||||
actions { |
||||
create_allocation {} |
||||
} |
Loading…
Reference in new issue