Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.mixmin.net!feeder.erje.net!border3.nntp.ams.giganews.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.brightview.co.uk!news.brightview.co.uk.POSTED!not-for-mail NNTP-Posting-Date: Fri, 02 Dec 2011 09:55:17 -0600 From: Mark Newsgroups: comp.lang.java.programmer Subject: Re: java.io.File Date: Fri, 02 Dec 2011 15:55:17 +0000 Message-ID: <5ushd716i6g4qncg620f49ancol20af51f@4ax.com> Cancel-Lock: sha1:A19wRpoLkdjV5enIreYBdem5kiI= References: <1754083.312.1322839502470.JavaMail.geo-discussion-forums@prjr26> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-NFilter: 1.2.0 Lines: 33 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-jp6r3wDJknXklsrSbC4SQeF1IU24aydunyhqfHozJmPGTFndFC48EevZpyHeaeGXCEHNwyyZUBkxp6k!Qf303rj/XioBvh31R4cAcXAHp0bg6VP509/LstF0ajcCgllSgNNv4xiNKTltCE+DC45Hhg1PQdFs!qawLtpsVWhbb4dQ+S6A= X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 2488 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:10426 On Fri, 2 Dec 2011 07:25:02 -0800 (PST), Lew wrote: >Mark wrote: >> Can a java.io.File object use a OS file descriptor? I am trying to >> find the source of a fd leak in a[n] application. > >At some point, depending on the operations performed by the 'File' instance, >there may be a file descriptor involved, and then the 'File' instance certainly >does use it, at least indirectly via JVM system calls that proxy to OS system >calls. > >From a Java perspective you should look for unclosed I/O streams/channels and >packratted 'File' instances rather than file descriptors. I've done a code inspection and the streams are all explicitly closed. There are a number of File objects used and I notice that File does not have a close() method so we have to rely on GC. >Of course I'm shooting in the dark since you've said absolutely nothing about >your application, much less provided an http://sscce.org/. I know. It would be difficult to produce an example since I cannot reproduce the problem myself - it happens in production only and I don't have any access there. I get the exception: java.io.IOException: Cannot run program "/path/to/script": java.io.IOException: error=24, Too many open files The script is called via ProcessBuilder object and I don't see any obvious problems there.