Operating System - HP-UX
1753400 Members
7142 Online
108792 Solutions
New Discussion юеВ

Re: /etc/profile[83]: cannot fork: too many processes

 
SOLVED
Go to solution
Jerry L. Sims
Frequent Advisor

/etc/profile[83]: cannot fork: too many processes

User Received the following error, but my local
syslog.log does not indicate any forking problems. Notice the error coming from the user ( c1rfern2 ) profile which is nfs mounted:

${HOME:-.}/.profile[4]: /home/c1rfern2/hras/psconfig.sh: not found

*********
$ bdf
Filesystem kbytes used avail %used Mounted on

/dev/vg02/applogs 8916992 5125120 3673378 58% /applogs
psh-cel-04:/cpprodsh_t
17573248 10150888 7422360 58% /cpprodsh
psh-cel-02:/local/hp/11i
8786112 3131240 5654872 36% /usr/local
psh-cel-02:/users1/ais/aordonez
26357312 17035632 9321680 65% /home/aordonez
psh-cel-02:/users1/ais/c1rfern2
26357312 17035632 9321680 65% /home/c1rfern2
********

Could this forking error actually be coming from the nfs mounted system ( psh-cel-02:/users1/ais/c1rfern2) ?

This is a command ( au2cptest ) entered that
switches the user ( c1rfern2 ) to the id (cptest), which delivers the "cannot fork"
error :

$ au2cptest
/etc/profile[31]: cannot fork: too many processes

/etc/profile[48]: cannot fork: too many processes

/etc/profile[83]: cannot fork: too many processes
8 REPLIES 8
Jeff Schussele
Honored Contributor
Solution

Re: /etc/profile[83]: cannot fork: too many processes

Hi Jerry,

You've overflowed one of two kernel parameters

1) NPROC
2) maxuprc

The former is system wide, the latter is user specific. Check syslog.log for clues.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Steven E. Protter
Exalted Contributor

Re: /etc/profile[83]: cannot fork: too many processes

Increase the kernel parameter maxusers

This will increase nproc and other parmeters that can cause this problem.

This process can be done by sam and requires a boot.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Jeff Schussele
Honored Contributor

Re: /etc/profile[83]: cannot fork: too many processes

Hi (again),

After rereading your post, I'd lean towards maxuprc. So run the following commands:

kmtune -q maxuprc # This tells you the max procs per user
Then
ps -fu c1rfern2 | wc -l # Approx procs in use by c1rfern2
Then
ps -fu cptest | wc -l #Approc procs in use by cptest

IF either of those 2nd/3rd commands are near the 1st - that's the problem.
If neither is then run:

kmtune -q nproc #Max system-wide processes

ps -ef | wc -l #Approx total processes in use.

IF that one's close then NPROC needs to be bumped up.

HTH,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jerry L. Sims
Frequent Advisor

Re: /etc/profile[83]: cannot fork: too many processes

syslog.log was the first place I checked, and
no forking messages are there? That's why I wondered if it could be from the NFS mounted system ?
Jeff Schussele
Honored Contributor

Re: /etc/profile[83]: cannot fork: too many processes

I would not recommend increasing maxusers UNLESS you *know* you need NFILE & NINODE increased as well because their values are formulae off maxusers by default. These are two of the heavier kernel memory burdens & I've rarely seen the case where they *needed* to go up at the same time as nproc.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: /etc/profile[83]: cannot fork: too many processes

No, the error messages are only generated on the system that is actually running the program regardless of NFS mountpoint and even regardless of whether or not the NFS file is the current directory.

The bad news is that fork() is one of the few system calls that sets errno to the same value (EAGAIN=11) for two separate reasons: 1) the system-wide process table limit (nproc) and 2) the user process limit (maxupc).

Because you are only seeing this error in limited circumstances, I would strongly suspect it's maxuprc biting you.
If it ain't broke, I can fix that.
Chris Vail
Honored Contributor

Re: /etc/profile[83]: cannot fork: too many processes

Your system probably has a run-away process. Normally, the default kernel parameters for nproc and maxuproc are adequate for most purposes. You can probably find out which process has run away with lsof if you have it installed already.
If you can figure out which process it is, you can clobber it with kill -9. Otherwise, you'll have to reboot the system (pretend its a M$ system--it'll make you feel better).

If this happens often, you might have to play with the maxuproc and nproc parameters, as other have suggested. But the cannot fork message is usually indicative of a system in serious trouble. Most likely this is because someone wrote some really bad code.


Chris
Bill Hassell
Honored Contributor

Re: /etc/profile[83]: cannot fork: too many processes

If "cannot fork: too many processes" does NOT appear in syslog.log or on the system console, the reason is maxuprc. The default value is 60, so if you run the command:

ps -fu c1rfern2

you'll see how many processes this user is running at the same time. maxuprc limits runaway or buggy processes. Now if this user (c1rfern2) really needs to run more than 60 processes (different login sessions don't matter) then bump maxuprc to 100 or more.


Bill Hassell, sysadmin