Fix insufficient resources error handling

When naive DoAccept failed on ERR_INSUFFICIENT_RESOURCES, rv is passed
to DoAcceptComplete, if rv is not OK, this function sets next state to
DoAccept again, when naive reaches system wide file discriptor limits,
and a pending CONNECT in queue, naive will be trapped in an infinite
busy spinning loop and can not recover as resources are not reclaimed.
pull/819/head
zihaofu245 2026-07-18 01:00:48 +02:00
parent 3ba967e2d3
commit e6d6e196be
1 changed files with 8 additions and 1 deletions

View File

@ -145,7 +145,14 @@ int NaiveProxy::DoAcceptComplete(int result) {
if (result != OK) {
next_state_ = State::kAccept;
LOG(ERROR) << "Accept error: " << ErrorToShortString(result);
// This accept error is ignored to start the next accept.
if (result == ERR_INSUFFICIENT_RESOURCES) {
base::SingleThreadTaskRunner::GetCurrentDefault()->PostDelayedTask(
FROM_HERE,
base::BindOnce(&NaiveProxy::OnIOComplete,
weak_ptr_factory_.GetWeakPtr(), OK),
base::Seconds(1));
return ERR_IO_PENDING;
}
return OK;
}