Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce thread count in ConcurrentHashMapTest to prevent system thread limit breach #2335

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions folly/concurrency/test/ConcurrentHashMapTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,10 +1156,11 @@ TYPED_TEST_P(ConcurrentHashMapTest, StressTestReclamation) {
EXPECT_TRUE(map.insert(std::make_pair(key_link_explosion, 0)).second);

std::vector<std::thread> threads;
// Test with (2^16)+ threads, enough to overflow a 16 bit integer.
// It should be uncommon to have more than 2^32 concurrent accesses.
static constexpr uint64_t num_threads = std::numeric_limits<uint16_t>::max();
static constexpr uint64_t iters = 100;
// It should be uncommon to have more than 1024 concurrent accesses.
// A higher thread number may cause the process to fail as the thread limit
// is breached.
static constexpr uint64_t num_threads = 1024;
static constexpr uint64_t iters = 1000;
folly::Latch start(num_threads);
for (uint64_t t = 0; t < num_threads; t++) {
threads.push_back(lib::thread([t, &map, &start]() {
Expand Down