- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ksh spawns another ksh process - RECURSIVELY
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
Forums
Discussions
Discussions
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
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
08-21-2006 02:44 AM
08-21-2006 02:44 AM
.
.
.
anair2 8397 8396 0 04:13:57 ? 0:00 -ksh
anair2 8223 8222 0 04:13:56 ? 0:00 -ksh
anair2 8087 8086 0 04:13:55 ? 0:00 -ksh
anair2 8475 8474 0 04:13:58 ? 0:00 -ksh
anair2 7634 7633 0 04:13:53 ? 0:00 -ksh
anair2 6761 6760 0 04:13:47 ? 0:00 -ksh
anair2 8129 8128 0 04:13:56 ? 0:00 -ksh
anair2 8159 8158 0 04:13:56 ? 0:00 -ksh
anair2 8432 8431 0 04:13:58 ? 0:00 -ksh
anair2 8308 8307 0 04:13:57 ? 0:00 -ksh
anair2 8496 8495 0 04:13:58 ? 0:00 -ksh
anair2 8417 8416 0 04:13:58 ? 0:00 -ksh
anair2 8392 8390 0 04:13:57 ? 0:00 -ksh
anair2 8455 8454 0 04:13:58 ? 0:00 -ksh
anair2 8042 8041 0 04:13:55 ? 0:00 -ksh
anair2 8435 8434 0 04:13:58 ? 0:00 -ksh
anair2 8487 8486 0 04:13:58 ? 0:00 -ksh
anair2 8387 8386 0 04:13:57 ? 0:00 -ksh
anair2 6743 6742 0 04:13:47 ? 0:00 -ksh
anair2 8310 8309 0 04:13:57 ? 0:00 -ksh
anair2 8422 8421 0 04:13:58 ? 0:00 -ksh
.
.
.
It's resulting in a full process table - and then I get nothing but "fork" errors like:
.profile[10]: The fork function failed. Too many processes already exist.
So - I'm in a bit of a quandary. My question - could this be something originating from INSIDE the server (a running process) - or from OUTSIDE the server (eg: an application persistently logging in every second).
Thanks in advance for any insight/help.
Later,
Ben.
bchapman@telcordia.com
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 02:47 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 02:51 AM
08-21-2006 02:51 AM
Re: ksh spawns another ksh process - RECURSIVELY
Check and see of a script is running that spawns a copy of itself.
Also make sure /etc/inittab was not used to spawn the script.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 02:52 AM
08-21-2006 02:52 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 02:59 AM
08-21-2006 02:59 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 03:35 AM
08-21-2006 03:35 AM
Re: ksh spawns another ksh process - RECURSIVELY
you have to kill the processes of the user 'anair2' as root in a way like that
ps -uanair2 | awk 'NR>1 {print $1}' | xargs kill
- call with differnt signals, in your situation kill -9 as secaond choice
- call more than once
Cause of your problem: sometimes a single
*
in a bin-directory is enough...
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 03:41 AM
08-21-2006 03:41 AM
Re: ksh spawns another ksh process - RECURSIVELY
Give this a shot:
# exec echo '/usr/bin/false' >> /etc/shells && passwd -e /usr/bin/false anair2 && UNIX95= kill $(ps -u anair2 -o pid=)
Change 'kill' to 'kill -9', if need be.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 04:03 AM
08-21-2006 04:03 AM
Re: ksh spawns another ksh process - RECURSIVELY
Console Login: root
Password:
Last successful login for root: Mon Aug 21 11:36:43 EST5EDT 2006 on console
Last unsuccessful login for root: Mon Aug 21 11:47:05 EST5EDT 2006 on console
Please wait...checking for disk quotas
could not execute quota command
/etc/profile[31]: The fork function failed. Too many processes already exist.
/etc/profile[48]: The fork function failed. Too many processes already exist.
/etc/profile[72]: The fork function failed. Too many processes already exist.
/etc/profile[143]: The fork function failed. Too many processes already exist.
/etc/profile[143]: test: Specify a parameter with this command.
.profile[10]: The fork function failed. Too many processes already exist.
.profile[20]: The fork function failed. Too many processes already exist.
WARNING: YOU ARE SUPERUSER !!
profit9# exec /usr/bin/ps -ef > /UTIL/p9.ps-ef.lst
That's the problem - is only being able to run one command every 10 minutes. Any ideas? Can I string them together w/ ";"? BTW - /UTIL is a common NFS mountpoint that I have on another HP-UX system - so I can then analyze the file and build a killscript to run thru "exec" again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 04:30 AM
08-21-2006 04:30 AM
Re: ksh spawns another ksh process - RECURSIVELY
This will kill processes owned by anair2 in ascending order of pid:
# exec ps -u anair2 | awk '!/PID/{print $1}' | sort -n | xargs kill
(UNIX95 variable left unset on purpose.)
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 04:41 AM
08-21-2006 04:41 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 04:55 AM
08-21-2006 04:55 AM
Re: ksh spawns another ksh process - RECURSIVELY
I tried - but to no avail (note - my $PATH isn't even set upon login to console - so I have to use explicit paths to all commands):
profit9# exec /usr/bin/ps -u anair2 | /usr/bin/awk '!/PID/{print $1}' | /usr/bin
/sort -n | /usr/bin/xargs kill
sh: The fork function failed. Too many processes already exist.
(and - that error - is generic for any commands that I try)
Any other ideas? I'm pretty close to "exec reboot" - and dealing w/ the fallout upon restart (Oracle db's recovering). Luckily this is only devel/test server - but still - how do I ensure this situation doesn't arise again? Somebody spoke earlier about a "*" (bad filename) in a "bin" directory - what's that about?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 05:07 AM
08-21-2006 05:07 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 05:54 AM
08-21-2006 05:54 AM
Re: ksh spawns another ksh process - RECURSIVELY
export PATH=/usr/bin:/usr/sbin
Make sure you DO NOT run exec reboot!!! You want a graceful shutdown and reboot will kill everything ungracefully. Run the command shutdown -y 0 then interrupt the boot process and issue hpux -is when you get to the ISL prompt. Once on the system,
1. rename the user's $HOME directory to something like /home/anair2BAD
2. remove any entry in /usr/spool/cron/crontabs/ with this user's name.
3. Lock the user's account so no login can take place from anywhere - the easiest is to rename the passwd file's line with anair2 to something like anair2BAD.
Now boot up and see that everything starts correctly. Finally, examine the anair2BAD directory to see if there is a .sh_history file and if so, look at the end of the file for the possible reason(s) for the runaway script.
Another thing to do is to limit the number of processes a user can run with the kernel parameter maxuprc to prevent a future mess like this, especially for a production machine. NOTE: maxuprc is used to count the total number of prcesses owned by one user. This means that it must be set high enough to accomodate Oracle and other applications, but low enough to prevent a runaway like this.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 10:18 AM
08-21-2006 10:18 AM
Re: ksh spawns another ksh process - RECURSIVELY
I did end up having to punt and:
-exec reboot (sorry Bill - saw your post one minute too late)
-hpux -is
-mount /var /usr /home
-lockout "bad" user
-examine "bad" user .sh_history
-shutdown -r 0
It did turn out to be a rogue program (well, accidentally). A new developer executed an Oracle PRO*Cobol program right at a shell prompt. No problem - except that the file starts out like this:
IDENTIFICATION DIVISION.
PROGRAM-ID. AR0129.
AUTHOR. JOHN DOE.
DATE-WRITTEN. DEC, 2003.
*********************************************************
** COPYRIGHT * 2003 XXXX. ALL RIGHTS RESERVED *
*********************************************************
** XXXX PROPRIETARY - INTERNAL USE ONLY *
.
.
.
So - now I know what happens when the shell interprets all those asterisks (*) - it launches a new ksh for all files in the current directory - for all asterisks (and then I think it's trying to execute all of the other .pco files in the dir - which recursively digs the hole deeper). I was able to recreate this by executing the code myself (sh -x) BEFORE brining up all the db's/appservers. Sure enough - another SSH session's "ps -ef" showed massive ksh processes by my ID.
Gotta love Oracle though - 6 DB's that I had to slam down - all started/recovered w/ no problems. Call it a day...
Again - many thanks for all the help on this.
Later,
Ben Chapman.
bchapman@telcordia.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 10:21 AM
08-21-2006 10:21 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 10:32 AM
08-21-2006 10:32 AM
Re: ksh spawns another ksh process - RECURSIVELY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2006 11:42 AM
08-21-2006 11:42 AM
Re: ksh spawns another ksh process - RECURSIVELY
But 666 is no better!! When you set the global write bit, you have told every user on your system that they have permission to totally trash the contents of your file at any time.
Don't get me started on -9.
Bill Hassell, sysadmin