Fix insufficient resources error handling (#819)

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.
This commit is contained in:
Zgrams
2026-09-06 09:35:08 +08:00
committed by GitHub
parent 3ba967e2d3
commit 769aaa53c3
+8 -1
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;
}