Fwd: sleep_after_fork

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Sat, 27 Jan 2001 11:24:45 +0100

Found an old forgotten patch from Duane in my archives. I think this is
a good thing in lack of a portable and trustworthy vfork() call...

/Henrik

attached mail follows:


Duane, you sent this patch on squid-bugs some months ago (during
2.2.STABLE3). As the patch looked good I added it to my 2.2.STABLE3
snapshot, but it apparently never got into the main release or even
mentioned on the bugs page (and thus got cleaned out when I moved to
2.2.STABLE4)

What has happened with it?

/Henrik

Costas Tavernarakis <taver@otenet.gr> wrote today:

Hello,

There used to be a TAG 'sleep_after_fork' in some of your earlier squid
2.2STABLE-3 patches. I cannot seem to find this in current 2.2STABLE5
snapshots, and i rather need this functionality. I cannot even find the
individual patch providing this functionality in your page.

I can't know why this was removed.... I can only find it in an
squid-2.2.STABLE3-henrik.19990627.snapshot i have kept.

Do you still have the patch? If so, is it too much to ask if you could
mail it to me?

I'm in almost depsarete need of this, especially since
squid-2.2.STABLE5.helper_rotate_log.patch, i'm getting a lot of
1999/11/15 05:07:39| ipcCreate: fork: (12) Not enough space
1999/11/15 05:07:39| WARNING: Cannot run '/var/proxy/bin/dnsserver'
process.
messages, and end up with only 4 dnsservers on every logrotate...

Thanks,

Index: squid/src/cf.data.pre
diff -u squid/src/cf.data.pre:1.1.1.36.2.7 squid/src/cf.data.pre:1.1.1.36.2.8
--- squid/src/cf.data.pre:1.1.1.36.2.7 Sun Jun 20 16:58:02 1999
+++ squid/src/cf.data.pre Tue Jun 22 22:31:21 1999
@@ -2883,4 +2883,20 @@
         and coredump files will be left there.
 DOC_END
 
+NAME: sleep_after_fork
+COMMENT: (microseconds)
+TYPE: int
+LOC: Config.sleep_after_fork
+DEFAULT: 0
+DOC_START
+ When this is set to a non-zero value, the main Squid process
+ sleeps the specified number of microseconds after a fork()
+ system call. This sleep may help the situation where your
+ system reports fork() failures due to lack of (virtual)
+ memory. Note, however, that if you have a lot of child
+ processes, then these sleep delays will add up and your
+ Squid will not service requests for some amount of time
+ until all the child processes have been started.
+DOC_END
+
 EOF
Index: squid/src/ipc.c
diff -u squid/src/ipc.c:1.1.1.7.14.1 squid/src/ipc.c:1.1.1.7.14.2
--- squid/src/ipc.c:1.1.1.7.14.1 Thu May 20 00:56:43 1999
+++ squid/src/ipc.c Tue Jun 22 22:31:22 1999
@@ -221,6 +221,12 @@
             *wfd = pwfd;
         fd_table[prfd].flags.ipc = 1;
         fd_table[pwfd].flags.ipc = 1;
+ if (Config.sleep_after_fork) {
+ struct timeval sl;
+ sl.tv_sec = Config.sleep_after_fork / 1000000;
+ sl.tv_usec = Config.sleep_after_fork % 1000000;
+ select(0, NULL, NULL, NULL, &sl);
+ }
         return pwfd;
     }
     /* child */
Index: squid/src/structs.h
diff -u squid/src/structs.h:1.1.1.37.10.11 squid/src/structs.h:1.1.1.37.10.12
--- squid/src/structs.h:1.1.1.37.10.11 Sun Jun 20 16:58:04 1999
+++ squid/src/structs.h Tue Jun 22 22:31:23 1999
@@ -450,6 +450,7 @@
 #endif
     HttpHeaderMask anonymize_headers;
     char *coredump_dir;
+ int sleep_after_fork; /* microseconds */
 };
 
 struct _SquidConfig2 {
Received on Sat Jan 27 2001 - 03:47:59 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:26 MST