mirror of
https://git.yoctoproject.org/poky
synced 2026-02-27 11:59:40 +01:00
Dropped patches: 0001-Use-epoll-API-on-Linux.patch replaced by http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/commit/?id=0a3e435085046f535074f498a3de75a7704fb14c (also add --enable-epoll to configure options) b6b68db896f9963558334aff7fca61adde4ec10f.patch merged upstream efe0be279901006f939cd357ccee47b651c786da.patch merged upstream fastopreply.patch replaced by http://git.yoctoproject.org/cgit/cgit.cgi/pseudo/commit/?id=449c234d3030328fb997b309511bb54598848a05 toomanyfiles.patch rebased (From OE-Core rev: 7c3df6782bbd5b623dcb6ee8a9bc914926640cdd) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
72 lines
2.1 KiB
Diff
72 lines
2.1 KiB
Diff
From b0b25fbc041a148d1de09f5a6503cd95973ec77c Mon Sep 17 00:00:00 2001
|
|
From: Richard Purdie <richard.purdie@linuxfoundation.org>
|
|
Date: Tue, 25 Apr 2017 15:25:54 +0100
|
|
Subject: [PATCH 3/3] pseudo: Handle too many files deadlock
|
|
|
|
Currently if we max out the maximum number of files, pseudo can deadlock, unable to
|
|
accept new connections yet unable to move forward and unblock the other processes
|
|
waiting either.
|
|
|
|
Rather than hang, when this happens, close out inactive connections, allowing us
|
|
to accept the new ones. The disconnected clients will simply reconnect. There is
|
|
a small risk of data loss here sadly but its better than hanging.
|
|
|
|
RP
|
|
2017/4/25
|
|
|
|
Upstream-Status: Submitted [Peter is aware of the issue]
|
|
|
|
---
|
|
pseudo_server.c | 10 ++++++++++
|
|
1 file changed, 10 insertions(+)
|
|
|
|
diff --git a/pseudo_server.c b/pseudo_server.c
|
|
index dac3258..15a3e8f 100644
|
|
--- a/pseudo_server.c
|
|
+++ b/pseudo_server.c
|
|
@@ -802,6 +802,7 @@ pseudo_server_loop(void) {
|
|
struct sigaction eat_usr2 = {
|
|
.sa_handler = set_do_list_clients
|
|
};
|
|
+ int hitmaxfiles;
|
|
|
|
clients = malloc(16 * sizeof(*clients));
|
|
|
|
@@ -820,6 +821,7 @@ pseudo_server_loop(void) {
|
|
active_clients = 1;
|
|
max_clients = 16;
|
|
highest_client = 0;
|
|
+ hitmaxfiles = 0;
|
|
|
|
pseudo_debug(PDBGF_SERVER, "server loop started.\n");
|
|
if (listen_fd < 0) {
|
|
@@ -878,10 +880,15 @@ pseudo_server_loop(void) {
|
|
} else {
|
|
serve_client(i);
|
|
}
|
|
+ } else if (hitmaxfiles) {
|
|
+ /* Only close one per loop iteration in the interests of caution */
|
|
+ close_client(i);
|
|
+ hitmaxfiles = 0;
|
|
}
|
|
if (die_forcefully)
|
|
break;
|
|
}
|
|
+ hitmaxfiles = 0;
|
|
if (!die_forcefully &&
|
|
(FD_ISSET(clients[0].fd, &events) ||
|
|
FD_ISSET(clients[0].fd, &reads))) {
|
|
@@ -903,6 +910,9 @@ pseudo_server_loop(void) {
|
|
*/
|
|
pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;
|
|
die_peacefully = 0;
|
|
+ } else if (errno == EMFILE) {
|
|
+ hitmaxfiles = 1;
|
|
+ pseudo_debug(PDBGF_SERVER, "Hit max open files, dropping a client.\n");
|
|
}
|
|
}
|
|
pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients);
|
|
--
|
|
2.15.1
|
|
|