- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: profile: cannot fork: too many processes
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 09:39 AM
тАО01-03-2011 09:39 AM
Re: profile: cannot fork: too many processes
ps -fu scott > abc.txt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 09:39 AM
тАО01-03-2011 09:39 AM
Re: profile: cannot fork: too many processes
VERY BAD CODE.
grep and ps can cause catastrophic results, especially when combined with kill. Never use grep to look for a user. Never use kill -9 as you can damage databases and application files.
To kill all the processes owned by scott, FIRST list all of them:
ps -fu scott
Then is all of them are OK to kill, you can apply the kill (and kill -1 if necessary):
ps -fu scott | awk '{print $2}' | xargs kill
and
ps -fu scott | awk '{print $2}' | xargs kill -1
That should take care of all the processes, but just to make sure:
ps -fu scott
grep will find things (partial user names, arguments on the command line, etc) you did not intend to be found.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 09:46 AM
тАО01-03-2011 09:46 AM
Re: profile: cannot fork: too many processes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 09:54 AM
тАО01-03-2011 09:54 AM
Re: profile: cannot fork: too many processes
It automatically gets created even after killing all processes owned by scott.
ps -fu scott | awk '{print $2}' | xargs kill
and
ps -fu scott | awk '{print $2}' | xargs kill -1
Count always remains the same :
ps -fu scott | wc -l
514
One more question
By parent-id is 1
scott 17613 1 0 17:52:18 ? 00:00:00 -ksh
scott 10636 1 0 17:48:54 ? 00:00:00 -ksh
scott 16406 10636 0 17:51:58 ? 00:00:00 -ksh
scott 16470 16406 0 17:52:00 ? 00:00:00 -ksh
scott 16620 16470 0 17:52:02 ? 00:00:00 -ksh
-3 16619 16470 0 17:52:02 ? 00:00:00
-3 16623 16406 0 17:52:02 ? 00:00:00
-3 14613 10636 0 17:50:58 ? 00:00:00
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 09:56 AM
тАО01-03-2011 09:56 AM
Re: profile: cannot fork: too many processes
vi /tmp/cleaner
{ cut below excluding this line }
#!/usr/bin/sh
ps -fu scott | while read line
do
PID=$(echo $line | awk {'print $2'}
PPID=$(echo $line | awk {'print $3'}
if [ $PPID -eq 1 ]
then
kill $PID
ps -ef | grep $PID; r=$?
if [ $r -eq 0 ]
then
kill -1 $PID
fi
ps -ef | grep $PID; r=$?
if [ $r -eq 0 ]
then
echo "Process $PID won't die"
fi
fi
done
{ cut above excluding this line }
make it executable
chmod 700 /tmp/cleaner
run it
/tmp/executable >/tmp/cleaner.out 2>&1
please post /tmp/cleaner.out here
UNIX because I majored in cryptology...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 10:13 AM
тАО01-03-2011 10:13 AM
Re: profile: cannot fork: too many processes
(lsof picked the first hardlink as the name.)
>Alzhy: Can you kill all of its processes right now in aid of diagnosis?
Much easier to do:
kill $(UNIX95=EXTENDED_PS ps -u scott -opid=)
Then change to kill -HUP then -9.
>Bill: ksh starts ksh starts ksh starts ksh
You have this with clearcase's setview.
>Then start killing the top level processes.
Right, a lot of them have init as the parent, possibly indicating they didn't log off correctly.
>I need to kill the script causing the issue?
Yes. You did that if you killed all of scott's PIDs.
>Mel: killing the parent process is killing all the children processes before your kill gets to them.
Right, that also reaps the zombies.
>please find the attachment
ps -fu scott > abc.txt
Please use this instead:
UNIX95=EXTENDED_PS ps -H -fu scott > abc.txt
It seems strange you still have lots of processes. You likely have a fork bomb with every process trying to create more, no matter which you kill.
Or it could be a problem with .profile/.kshrc since I don't see any scripts or options on any of the ksh entries.
You may want to stop them all then kill them:
kill -STOP $(UNIX95=EXTENDED_PS ps -u scott -opid=)
kill $(UNIX95=EXTENDED_PS ps -u scott -opid=)
>Bill: ps -fu scott | awk '{print $2}' | xargs kill
No need to use awk and xargs:
kill $(UNIX95=EXTENDED_PS ps -u scott -opid=)
>One more question. By parent-id is 1
>scott 17613 1 0 17:52:18 ? 00:00:00 -ksh
Right, these orphans have had their parent killed and are adopted by init.
>Mel: put this code below in a file:
My "kill -STOP" will probably be easier.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 10:13 AM
тАО01-03-2011 10:13 AM
Re: profile: cannot fork: too many processes
ps -fu scott | wc -l
514
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 10:27 AM
тАО01-03-2011 10:27 AM
Re: profile: cannot fork: too many processes
This gives a lot of bogus output due to what Bill said about ps and grep.
Instead of doing:
ps -ef | grep $PID; r=$?
if [ $r -eq 0 ]; then
Do:
ps -p $PID > /dev/null 2>&1
if [ $? -eq 0 ]; then
Or:
kill -0 $PID 2> /dev/null
if [ $? -eq 0 ]; then
Anyway, this is moot, since you need that -STOP first.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 10:39 AM
тАО01-03-2011 10:39 AM
Re: profile: cannot fork: too many processes
kill -9 `ps -ef|grep -w scott|awk '{print $2}'`
ps -fu scott|wc -l
ps -ef -u scott|tee scott.txt
Paste so there is no "wait" in between...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-03-2011 11:00 AM
тАО01-03-2011 11:00 AM
Re: profile: cannot fork: too many processes
ps -fu scott | while read line
do
PID=$(echo $line | awk {'print $2'}
PPID=$(echo $line | awk {'print $3'}
if [ $PPID -eq 1 ]
then
kill -0 $PID 2> /dev/null
if [ $? -eq 0 ]; then
kill -1 $PID 2> /dev/null
fi
if [ $? -eq 0 ]
then
echo "Process $PID won't die"
fi
fi
done
Dennis where to put -STOP in above code
is above code ok to run