File Descriptors

File Descriptors

Post by Mark Stace » Fri, 17 Mar 2000 04:00:00



Hi,

I have a situation where I have a webserver that starts a servlet
engine. The problem is that the servlet engine is only being assigned 64
file descriptors, and the Sun JVM crashes if it needs more file
descriptors than is available. I'm looking for a way to increase the
file descriptor limit for the servlet engine.

I've tried setting the limit from the command line and then running the
webserver, the webserver picks up the new descriptor limit, but the
servlet engine it spawns doesn't, it still defaults to 64. I've also
tried setting the limits in the /etc/system file, but again to no
effect. The only way I've gotten around it is to write a small wrapper
script that starts a new shell, sets the limit, and then starts the
servlet engine:

#!/bin/csh

limit descriptors 512; /path/to/java $*

This works, but seems to be more of a hack than anything. What is the
correct way of solving this? Is there a shell environment variable that
I can set that will be picked up by all parent and child proceses?

Thanks

--
Mark Stacey
   Software Engineer
   ICL Information Technology Centre
   Tel.  : +353 1 2161808

Sun Microsystems Certified Java 1.1 Programmer
Sun Microsystems Certified Java 1.1 Developer

This e-mail is intended only for the addressee named above. As this
e-mail may contain confidential or privileged information if you are
not, or suspect that you are not, the named addressee or the person
responsible for delivering the message to the named addressee, please
telephone us immediately. Please note that we cannot guarantee that this
message or any attachment is virus free or has not been intercepted and
amended. The views of the author may not necessarily reflect those of
the Company.

 
 
 

File Descriptors

Post by Barry Margoli » Fri, 17 Mar 2000 04:00:00



Quote:>Hi,

>I have a situation where I have a webserver that starts a servlet
>engine. The problem is that the servlet engine is only being assigned 64
>file descriptors, and the Sun JVM crashes if it needs more file
>descriptors than is available. I'm looking for a way to increase the
>file descriptor limit for the servlet engine.

>I've tried setting the limit from the command line and then running the
>webserver, the webserver picks up the new descriptor limit, but the
>servlet engine it spawns doesn't, it still defaults to 64. I've also
>tried setting the limits in the /etc/system file, but again to no
>effect. The only way I've gotten around it is to write a small wrapper
>script that starts a new shell, sets the limit, and then starts the
>servlet engine:

>#!/bin/csh

>limit descriptors 512; /path/to/java $*

>This works, but seems to be more of a hack than anything. What is the
>correct way of solving this? Is there a shell environment variable that
>I can set that will be picked up by all parent and child proceses?

This sounds like the web server is explicitly reducing the descriptor limit
before starting the servlet.  I suggest check its documentation to see if
this limit is configurable.

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. "Bad file descriptor" with Bash; how to designate descriptors?

I have a trivial script which tails multiple files by
spawning a 'tail' process for each file and duping the
output into one file descriptor which is then tailed:

  for f in $*; do
        tail -1f $f >&3 &
  done

  exec <&3
  tail -f

This works fine under Sun ksh, but I've just tried to run
it now with Bash under Linux 2.4.16, only to have each
command using file descriptor 3 fail with a

  'Bad file descriptor'

error.

This has caught me completely unawares.  The bash manpage
says that

  "If the digits in word do not specify a file descriptor open
  for output, a redirection error occurs"

How do I open file descriptor 3 for output?  Or, if I do
something like

  tail -1f file > /dev/null &

how can I find out what file descriptor is opened so I can
direct the output of further tail commands to the same
descriptor?  What's the magic that bash needs to be able to
do something like this?

Many thanks,

Brad

2. sobre subdominios

3. portable way to convert FILE ptr to file descriptor?

4. Remote access to computer

5. how to get file length from file descriptor

6. Utimaco CardMan compact serialport smartcard CT-API driver

7. *FILE and int as file descriptors.

8. Installing two linux distros.

9. Grabbing file from file descriptors

10. FILE descriptor and file id conversion?

11. difference b/w file pointer and file descriptor

12. kernel: Cannot read proc file system: 9 - Bad file descriptor

13. Fast way to write a file to a file descriptor or stream?