Bugs item #823561, was opened at 2003-10-14 09:56
Message generated for change (Comment added) made by starksm
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=823561&group_id=22866

Category: JBossServer
Group: v3.2
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Kevin Kalmbach (kkalmbach)
Assigned to: Scott M Stark (starksm)
Summary: checking log4j.xml leaves open file descriptors

Initial Comment:
The Log4JService mbean leaks file desriptors when it
checks if the log4j.xml file has been updated.

Theproblem is in the URLWatchTimeTask inner class.
When it does a conn.getLastModified() in the run method
, this opens the file.  Nothing closes it (except the GC).

This becomes a problem when the GC is not running
enough and the java process runs out of file
descriptors, then no more files can be opened and bad
things happen.

My proposed solution is to add a finally block around
the try that is already there and add a
conn.getInputStream().close().  This does close the file.

We have verified this on Solaris 8 and Linux 2.4.

I have included a small test file that shows the problem.  
To run it type java test2 file:///home/you/somefile.txt

It will run through a loop of 100, then sleep forever,
this sleep will give you a chance to look at open files.

To view open files, you can look in /proc/<pid>/fd (on
most *nix systems) or run lsof.

This happens on JDK 1.3.X and 1.4.2


Let me know 
-Thanks
-Kevin

----------------------------------------------------------------------

>Comment By: Scott M Stark (starksm)
Date: 2003-10-18 21:33

Message:
Logged In: YES 
user_id=175228

The resource protocol handler has been updated to return a
JBoss file protocol handler.


----------------------------------------------------------------------

Comment By: Kevin Kalmbach (kkalmbach)
Date: 2003-10-15 12:27

Message:
Logged In: YES 
user_id=886852

One more thing...
If I do a java test2 file:///XXXXX
The println on conn is
conn =
org.jboss.net.protocol.file.FileURLConnection:file:/tmp/x.txt

when I do a resource:x.txt I get
conn =
org.jboss.net.protocol.resource.ResourceURLConnection:resource:x.txt{
sun.net.www.protocol.file.FileURLConnection:file:/home/kkalmbac/java/watchdog/x.txt
}


Our jboss-service.xml has a ConfigurationURL of
resource:log4j.xml


----------------------------------------------------------------------

Comment By: Kevin Kalmbach (kkalmbach)
Date: 2003-10-15 12:20

Message:
Logged In: YES 
user_id=886852

OK, in your code with your URLStreamHandler, do a 
java test2 resource:x.txt
(make sure x.txt is available as a resource)
If I do this with your code I get the open fd's again


----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2003-10-15 10:47

Message:
Logged In: YES 
user_id=175228

I don't see this behavior with the JBoss file protocol
handler which is what is installed by default. Running the
updated version of test2.java shows only the standard
descriptors in use. Reopen with additional details on what
the source of the fd usage is.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=823561&group_id=22866


-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to