diff options
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch')
-rw-r--r-- | import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch b/import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch index b085a4505..bda7e4b20 100644 --- a/import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch +++ b/import-layers/yocto-poky/meta/recipes-devtools/pseudo/files/toomanyfiles.patch @@ -1,3 +1,8 @@ +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. @@ -11,19 +16,23 @@ RP Upstream-Status: Submitted [Peter is aware of the issue] -Index: pseudo-1.8.2/pseudo_server.c -=================================================================== ---- pseudo-1.8.2.orig/pseudo_server.c -+++ pseudo-1.8.2/pseudo_server.c -@@ -581,6 +581,7 @@ pseudo_server_loop(void) { - int rc; - int fd; - int loop_timeout = pseudo_server_timeout; +--- + 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)); -@@ -597,6 +598,7 @@ pseudo_server_loop(void) { +@@ -820,6 +821,7 @@ pseudo_server_loop(void) { active_clients = 1; max_clients = 16; highest_client = 0; @@ -31,9 +40,9 @@ Index: pseudo-1.8.2/pseudo_server.c pseudo_debug(PDBGF_SERVER, "server loop started.\n"); if (listen_fd < 0) { -@@ -663,10 +665,15 @@ pseudo_server_loop(void) { - message_time.tv_usec -= 1000000; - ++message_time.tv_sec; +@@ -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 */ @@ -47,13 +56,16 @@ Index: pseudo-1.8.2/pseudo_server.c if (!die_forcefully && (FD_ISSET(clients[0].fd, &events) || FD_ISSET(clients[0].fd, &reads))) { -@@ -688,6 +698,9 @@ pseudo_server_loop(void) { - */ - pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT; - die_peacefully = 0; +@@ -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 + |