setrlimit(RLIMIT_STACK, RLIM_INFINITY) considered harmful

"Miquel van Smoorenburg" list-inn-workers at news.cistron.nl
Fri Nov 26 14:53:23 UTC 2004


Startinnfeed sets the DATA and STACK limits to infinity. I upgraded
my feeders kernel from linux 2.6.7 to 2.6.9, and suddenly in 
some cases innfeed grabbed 2 GB (the 1 GB - 3GB address space)
of stack. Nothing was allocated in it (as VSZ showed) but there
was no space left to mmap() in articles to send, and that's bad.

Now this might be a kernel bug, or a glibc bug, but why would any
application set the stack size to unlimited ? Under Linux it's
8 MB by default, and innfeed only used 8-16k or so of stack.

Patch:

--- inn-STABLE-20041124.orig/innfeed/startinnfeed.c	Sun Jan 19 02:15:32 2003
+++ inn-STABLE-20041124/innfeed/startinnfeed.c	Thu Nov 25 16:56:20 2004
@@ -91,7 +91,7 @@
 # ifdef RLIMIT_DATA
     setrlimit(RLIMIT_DATA, &rl);
 # endif
-# ifdef RLIMIT_STACK
+# if defined RLIMIT_STACK && !defined(__linux__)
     setrlimit(RLIMIT_STACK, &rl);
 # endif
 #endif /* HAVE_SETRLIMIT */


Mike.

-- 
The From: and Reply-To: addresses are internal news2mail gateway addresses.
Reply to the list or to "Miquel van Smoorenburg" <miquels at cistron.nl>


More information about the inn-workers mailing list