summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/pseudo/files/toomanyfiles.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/pseudo/files/toomanyfiles.patch')
-rw-r--r--meta/recipes-devtools/pseudo/files/toomanyfiles.patch44
1 files changed, 28 insertions, 16 deletions
diff --git a/meta/recipes-devtools/pseudo/files/toomanyfiles.patch b/meta/recipes-devtools/pseudo/files/toomanyfiles.patch
index b085a4505d..bda7e4b202 100644
--- a/meta/recipes-devtools/pseudo/files/toomanyfiles.patch
+++ b/meta/recipes-devtools/pseudo/files/toomanyfiles.patch
@@ -1,3 +1,8 @@
1From b0b25fbc041a148d1de09f5a6503cd95973ec77c Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Tue, 25 Apr 2017 15:25:54 +0100
4Subject: [PATCH 3/3] pseudo: Handle too many files deadlock
5
1Currently if we max out the maximum number of files, pseudo can deadlock, unable to 6Currently if we max out the maximum number of files, pseudo can deadlock, unable to
2accept new connections yet unable to move forward and unblock the other processes 7accept new connections yet unable to move forward and unblock the other processes
3waiting either. 8waiting either.
@@ -11,19 +16,23 @@ RP
11 16
12Upstream-Status: Submitted [Peter is aware of the issue] 17Upstream-Status: Submitted [Peter is aware of the issue]
13 18
14Index: pseudo-1.8.2/pseudo_server.c 19---
15=================================================================== 20 pseudo_server.c | 10 ++++++++++
16--- pseudo-1.8.2.orig/pseudo_server.c 21 1 file changed, 10 insertions(+)
17+++ pseudo-1.8.2/pseudo_server.c 22
18@@ -581,6 +581,7 @@ pseudo_server_loop(void) { 23diff --git a/pseudo_server.c b/pseudo_server.c
19 int rc; 24index dac3258..15a3e8f 100644
20 int fd; 25--- a/pseudo_server.c
21 int loop_timeout = pseudo_server_timeout; 26+++ b/pseudo_server.c
27@@ -802,6 +802,7 @@ pseudo_server_loop(void) {
28 struct sigaction eat_usr2 = {
29 .sa_handler = set_do_list_clients
30 };
22+ int hitmaxfiles; 31+ int hitmaxfiles;
23 32
24 clients = malloc(16 * sizeof(*clients)); 33 clients = malloc(16 * sizeof(*clients));
25 34
26@@ -597,6 +598,7 @@ pseudo_server_loop(void) { 35@@ -820,6 +821,7 @@ pseudo_server_loop(void) {
27 active_clients = 1; 36 active_clients = 1;
28 max_clients = 16; 37 max_clients = 16;
29 highest_client = 0; 38 highest_client = 0;
@@ -31,9 +40,9 @@ Index: pseudo-1.8.2/pseudo_server.c
31 40
32 pseudo_debug(PDBGF_SERVER, "server loop started.\n"); 41 pseudo_debug(PDBGF_SERVER, "server loop started.\n");
33 if (listen_fd < 0) { 42 if (listen_fd < 0) {
34@@ -663,10 +665,15 @@ pseudo_server_loop(void) { 43@@ -878,10 +880,15 @@ pseudo_server_loop(void) {
35 message_time.tv_usec -= 1000000; 44 } else {
36 ++message_time.tv_sec; 45 serve_client(i);
37 } 46 }
38+ } else if (hitmaxfiles) { 47+ } else if (hitmaxfiles) {
39+ /* Only close one per loop iteration in the interests of caution */ 48+ /* Only close one per loop iteration in the interests of caution */
@@ -47,13 +56,16 @@ Index: pseudo-1.8.2/pseudo_server.c
47 if (!die_forcefully && 56 if (!die_forcefully &&
48 (FD_ISSET(clients[0].fd, &events) || 57 (FD_ISSET(clients[0].fd, &events) ||
49 FD_ISSET(clients[0].fd, &reads))) { 58 FD_ISSET(clients[0].fd, &reads))) {
50@@ -688,6 +698,9 @@ pseudo_server_loop(void) { 59@@ -903,6 +910,9 @@ pseudo_server_loop(void) {
51 */ 60 */
52 pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT; 61 pseudo_server_timeout = DEFAULT_PSEUDO_SERVER_TIMEOUT;
53 die_peacefully = 0; 62 die_peacefully = 0;
54+ } else if (errno == EMFILE) { 63+ } else if (errno == EMFILE) {
55+ hitmaxfiles = 1; 64+ hitmaxfiles = 1;
56+ pseudo_debug(PDBGF_SERVER, "Hit max open files, dropping a client.\n"); 65+ pseudo_debug(PDBGF_SERVER, "Hit max open files, dropping a client.\n");
57 } 66 }
58 } 67 }
59 pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients); 68 pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients);
69--
702.15.1
71