Skip to content

Commit

Permalink
Decrease max aio events when io_setup() failed. (#1689)
Browse files Browse the repository at this point in the history
  • Loading branch information
Barenboim authored Jan 15, 2025
1 parent 58ea077 commit 24dd761
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/manager/WFGlobal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,19 @@ inline IOService *__CommManager::get_io_service()
if (!fio_flag_)
{
int maxevents = WFGlobal::get_global_settings()->fio_max_events;
int n = 65536;

fio_service_ = new __FileIOService(&scheduler_);
if (fio_service_->init(maxevents) < 0)
abort();
while (fio_service_->init(maxevents) < 0)
{
if ((errno != EAGAIN && errno != EINVAL) || maxevents <= 16)
abort();

while (n >= maxevents)
n /= 2;

maxevents = n;
}

if (fio_service_->bind() < 0)
abort();
Expand Down

0 comments on commit 24dd761

Please sign in to comment.