Commit 48c0902
committed
Pause accept on EMFILE/ENFILE to prevent CPU spin
When accept() fails with EMFILE or ENFILE, pending connections
keep POLLIN set on the listen socket, causing a tight loop.
Set an accept_paused flag on EMFILE/ENFILE that disables POLLIN
on the listen fd. Clear it when any connection closes, freeing
an fd for new accepts.1 parent 5a11b8d commit 48c0902
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| 288 | + | |
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| |||
1411 | 1413 | | |
1412 | 1414 | | |
1413 | 1415 | | |
1414 | | - | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
1415 | 1420 | | |
1416 | 1421 | | |
1417 | 1422 | | |
| |||
1501 | 1506 | | |
1502 | 1507 | | |
1503 | 1508 | | |
1504 | | - | |
| 1509 | + | |
| 1510 | + | |
1505 | 1511 | | |
1506 | 1512 | | |
1507 | 1513 | | |
| |||
0 commit comments