error : can not fork new process


 
Thread Tools Search this Thread
Operating Systems HP-UX error : can not fork new process
# 1  
Old 10-23-2008
error : can not fork new process

hi
today we came across error "can not fork new process" when i checked there were 400 ksh processes were running for that particular user ( due to kernel parameter setting no of processes were restricted to 400 ) and the reason for this was somebody executed shell script which had "*" ( only * in line nothing else ) in some lines. ( and sadly there were some more scripts present with * in between )

to kill i logged in as root then ps -fu <user> | awk '{print $2}' | xargs kill -9
and even after that there were 400 processes running ( with new PID ) now next was to kill all users on mount point for that i used fuser -kuc <mp> that didnt help either i used fuser at least 10-15 times still it was of no use. then i called our sysadmin ( i am not sys admin ) who told me to rename ksh. i did that but still no help. i ended up rebooting server.

i have some questions ...

1) even after renaming ksh , why there were so many ksh processes running ? there is no ksh on server after renaming then how ?
2) what are other ways of stopping this ? its not possible to reboot server every time.
# 2  
Old 10-23-2008
The * tried to execute everything in the current directory probably /home/careless_user.

chmod -R 000 /home/careless_user will stop new process creation.
chmod 000 /usr/bin/ksh or renaming it will just cause a lot of other scripts to bomb

Since the * tries to execute every file in the directory, the processes that were halfway done with trying to run stuff will be short-circuited. No new processes can start any children. A few seconds after you chmod 000 everything, you are in a position to try to kill the remaining processes, since they cannot create children.
Code:
kill -9 $(ps -e | |grep 'careless_user$' | awk '{print $1 }')

400 pids will not exceed ARG_MAX, so this should work without error.

Things are also interesting when a user creates a file named * - rsync and backup scripts just love it.
# 3  
Old 10-24-2008
Hi Zedex,

A fork can fail due to many reasons. It technically depends on the error message you find on your syslog. If you could give us the exact error message, it would be useful. It may be because of nprocs or maxuprc, swap memory kinda stuff.

A easy fact of this message is that a program is spawning too many processes or even by calling itself.

I believe that your issue should be with maxuprc. Give us more information. Also, what is the OS release you are using?

-DB
# 4  
Old 10-25-2008
Quote:
then i called our sysadmin ( i am not sys admin ) who told me to rename ksh.
Does he ( your sysadmin) remember most users on HPUX have /usr/bin/ksh as default shell (in /etc/passwd...)?
What if root can login only at the console, and no one were connected? Who will su root?...

When you say 400 proc max, what value are you talking about? nproc or maxuprc?
The difference? One is global - for all the system, the other is per user...

I, would start by removing . in the path of that user, if not enough, change his login shell to rksh and perhaps use script to see what he is up to, this reminds me - Have you looked in his .sh_history to see what he was doing ? This may give you some clues...

And you have mentioned you had scripts that may be the cause , I would go and chase them and I would remove execute permission on them, then try to understand their content...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Problem with fork() and execlp process

Hello everyone, this is my first post. I have a task to use a fork to create multiple processes and then use execlp to run another program to add 2 numbers. The problem I am having is we are supposed to use the exit() call in the execlp to return the small integer. This is a bad way to... (3 Replies)
Discussion started by: Johnathan_1017
3 Replies

2. Programming

Generating Random Number in Child Process using Fork

Hello All, I am stuck up in a program where the rand functions ends up giving all the same integers. Tried sleep, but the numbers turned out to be same... Can anyone help me out how to fix this issue ? I have called the srand once in the program, but I feel like when I call fork the child process... (5 Replies)
Discussion started by: manisum
5 Replies

3. Programming

fork n process

Making a C program (process PP) that satisfies the following requirements: 1. Pp receives 3 ≤ N ≤ 10 arguments on the command line invocation, to interpret as a whole and thus should be 1 ≤ Ni ≤ 4; 2. Pp initially will have to create N processes Pi children facing a range of life to ... (1 Reply)
Discussion started by: loweherz
1 Replies

4. Programming

Timed action after fork() in parent process

Assume you have such a piece of (more or less pseudo-)code: if(fork() == 0) {// childprocess chmod(someProgram, 00777); exec(someProgram); } else { // assume it never fails and this is the parent chmod(someProgram, 00000); // should be executed as soon as possible after the... (5 Replies)
Discussion started by: disaster
5 Replies

5. Red Hat

Fork wait in background process - large delay

hi all, We are trying to run a process in the background and in the process we call fork ;and wait for the child process to finish .We find that the died = wait(&status); happens after 10 seconds randomly and sometimes completes in time (within 1 sec) This behavior is seen only when the... (1 Reply)
Discussion started by: vishnu.priya
1 Replies

6. Red Hat

Fork wait in background process - large delay

hi all, We are trying to run a process in the background and in the process we call fork ;and wait for the child process to finish .We find that the died = wait(&status); happens after 10 seconds randomly and sometimes completes in time (within 1 sec) This behavior is seen only when the... (0 Replies)
Discussion started by: vishnu.priya
0 Replies

7. UNIX for Dummies Questions & Answers

cannot fork process on IBM - AIX

Hi, Currently, I'm getting the foll error on an IBM AIX /etc/profile: 0403-030 The fork function failed. Too many processes already exist. How can i check the current no. of processes which can run simultaneously on an IBM AIX machine for oracle user and how can i change ? Thanks Vin (1 Reply)
Discussion started by: win_vin
1 Replies

8. Programming

Multiple process using fork()

I have a code which has four different process, each printing different message. I have provided it with user input (implemented using thread), depending on which the corresponding message from that process has to be printed.The code is shown below.when I run the pgm, it takes input such as... (1 Reply)
Discussion started by: shashi
1 Replies

9. UNIX for Dummies Questions & Answers

Cannot fork , too many process - SCO Unix 5.05

I need a help... I have a HP Netserver LH 6000 U with Hardware Raid . Sco 5.0.5 installed with Oracle database. Total number of users, normally logged in are around 60 nos. The system is very slow ( takes 6 hours for processing one Lakh bills) during the Billing process. Also it is... (1 Reply)
Discussion started by: saleeshpl
1 Replies

10. Programming

Reference Variables To A Child Process Created With Fork

Hi! IN THE FOLLOWING PROGRAM THE VALUE OF j REMAINS UNCHANGED . WHY ? IF I WANT A VARIABLE VALUE TO CHANGE LIKE THIS , IS THERE ANY WAY TO DO IT ? Or do we have to use shared memory variables? main() { int return_pid, i, total; int j=1; total = TOTALRECS+1; for... (2 Replies)
Discussion started by: AJAY BHATIA
2 Replies
Login or Register to Ask a Question