fork: Resource temporarily unavailable - What can I check ? | Unix Linux Forums | Solaris

  Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

fork: Resource temporarily unavailable - What can I check ?

Solaris


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-11-2007
unclefab unclefab is offline
Registered User
 
Join Date: Jan 2005
Last Activity: 27 August 2012, 9:19 AM EDT
Posts: 40
Thanks: 1
Thanked 1 Time in 1 Post
fork: Resource temporarily unavailable - What can I check ?

Hi everybody,

I have an Unix box running Solaris and every day for 1 hour or 2 the box is stuck and I can only get this error message when trying to type a command :

bash-3.00$ vmstat 5
bash: fork: Resource temporarily unavailable


How can I trace what's is going wrong with this box ? Which commands are useful to run before and after the issue ?

Thanks a lot !

Fabien
Sponsored Links
    #2  
Old 04-11-2007
reborg's Avatar
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 10 Times in 10 Posts
Sounds like you are running out of swap, try putting a cronjob in to run "df" very 5 minutes and append to a file, then after the next time it happens go back and see if usage of /tmp was growing.

Alternatively, do the same interactively and see if someone is writing to a file or files in /tmp and filling it.
Sponsored Links
    #3  
Old 04-11-2007
porter porter is offline Forum Advisor  
Registered User
 
Join Date: Jan 2007
Last Activity: 8 January 2008, 6:50 PM EST
Posts: 2,965
Thanks: 0
Thanked 5 Times in 5 Posts
If you can't fork you can't run a command in a shell to see why it can't fork, as it needs to fork to create the process to run the command in.
    #4  
Old 04-11-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 18 April 2014, 11:48 PM EDT
Location: Ashburn, Virginia
Posts: 9,833
Thanks: 42
Thanked 378 Times in 225 Posts
Quote:
Originally Posted by porter
If you can't fork you can't run a command in a shell to see why it can't fork, as it needs to fork to create the process to run the command in.
First, reborg suggested arranging for a command to run every five minutes which might show /tmp filling prior to being totally filled. And it is possible for a large process to be unable to fork while smaller processes have no problem. This is actually quite common. Finally, it is not exactly true that a shell must fork to run a command. A shell is programming language with lots of built in commands. Can't launch ls?
$ myls() { while [ $# -ne 0 ] ; do echo "$1" ; shift ; done ; }
$ myls /etc/s*
/etc/services
/etc/shells
/etc/syslog.conf
$
Can't launch cat?
$ mycat() { while IFS="" read l ; do echo "$l" ; done < $1 ; }
$ mycat /etc/shells
#
# This is a list of valid login shells (single rooted).
# Ftpd must see one of these shells as a user's login shell to connect.
#
/bin/sh
/bin/ksh
/bin/csh
/bin/tcsh
/usr/local/bin/bash
$
None of that needed a single fork provided I use ksh. I can conjure up limited versions of quite a few commands this way. And if I am desperate to diagnose a stalled OS before I cycle power, I have a final trick...I can run a single command by using exec...
exec df -k
A box that cannot fork can often exec.
Sponsored Links
    #5  
Old 04-12-2007
reborg's Avatar
reborg reborg is offline Forum Advisor  
Administrator Emeritus
 
Join Date: Mar 2005
Last Activity: 29 March 2012, 7:00 PM EDT
Location: Ireland
Posts: 4,464
Thanks: 0
Thanked 10 Times in 10 Posts
Quote:
Originally Posted by Perderabo
And it is possible for a large process to be unable to fork while smaller processes have no problem.
Quite right of course and as an extension, some bigger process might die because it runs out of memory, leaving enough room for applications with a smaller memory footprint to run quite happily.

Both of the suggestion I posted were to run prior to the problem happening. The cron to give a general idea of what was happening, or more simply to periodically run the commands before the problem happened which might in fact point out the exact cause before the problem happened for example some application or script writing a huge log file to /tmp.

Last edited by reborg; 04-12-2007 at 06:17 PM..
Sponsored Links
    #6  
Old 04-12-2007
Sowser Sowser is offline
Registered User
 
Join Date: Sep 2006
Last Activity: 30 October 2008, 12:31 PM EDT
Posts: 90
Thanks: 0
Thanked 0 Times in 0 Posts
nice, really nice

Perderabo,

You have any other functions in that neat bag of tricks? Those functions are really helpful.

-S
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Fork: Resource Temporarily Unavailable monstrousturtle UNIX for Dummies Questions & Answers 3 05-03-2012 02:46 PM
fork: Resource temporarily unavailable , server unexpectedly unavailable network connection taherahmed UNIX for Advanced & Expert Users 1 09-13-2011 03:57 PM
Resource temporarily unavailable Error In Socket kavinsivakumar UNIX for Dummies Questions & Answers 1 03-02-2010 07:56 AM
Mmap with fork : Resource unavaialable temporarily siddharoodh Solaris 0 07-11-2009 02:20 PM
Fork:resource unavailable samos UNIX for Advanced & Expert Users 5 04-19-2009 08:25 PM



All times are GMT -4. The time now is 12:41 AM.