Bug 119890 - Procmail's formail incorrectly implements maxprocs
Bug#: 119890 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: critical Priority: P2
Resolution: FIXED Assigned To: net-mail@gentoo.org Reported By: ahbritto@iat.com
Component: Applications
URL: 
Summary: Procmail's formail incorrectly implements maxprocs
Keywords:  
Status Whiteboard: 
Opened: 2006-01-22 00:55 0000
Description:   Opened: 2006-01-22 00:55 0000
Procmail's formail command's "-n X" creates too many jobs.  This can hang the
machine by: (1) causing processess to be killed due to out of memory errors,
(2) causing thrashing by forcing jobs to swap, (3) prevent new processes from
spawning.

Steps to reproduce:
In a window:
watch -n .1 pgrep '[s]leep'

In another window:
formail -n 2 -s sleep 2 < AN_MBOX_WITH_AT_LEAST_10_MESSAGES

Actual results: more than two processes show up in watch command.

Expected results: two processes show up at most in watch command.

Procmail version:
mail-filter/procmail-3.22-r7

------- Comment #1 From Arthur Britto 2006-01-22 00:59:18 0000 -------
Created an attachment (id=77783) [details]
Fix for bug.

Obvious fix.

Previously, each time there were too many children, the code would allow one
more child to be created the next time there were too many children.

This fix removes the extra decrement on a variable containing the number of
outstanding children.  Such that, a decrement only occurs once per child
reaped.

------- Comment #2 From Fernando J. Pereda (RETIRED) 2006-05-12 00:05:08 0000 -------
Done, thanks and sorry for the looooong delay.

- ferdy