[ 
http://issues.apache.org/jira/browse/VELOCITY-157?page=comments#action_12330813 
] 

Nathan Bubna commented on VELOCITY-157:
---------------------------------------

Ok, this test (with the use of that "handle" util for windows), worked for me 
(unlike the one in VELOCITY-193).  And I can confirm that the patch i suggested 
in VELOCITY-193 for the AvalonLogSystem does indeed drastically reduce the 
number of file handles/descriptors/pointers/whatever.

so, for the sake of redundancy:  we should add the following to the bottom of 
AvalonLogSystem to make sure that the FileTargets are released when the 
LogSystem is GC'd.

    /**
     * Also do a shutdown if the object is destroy()'d.
     */
    protected void finalize() throws Throwable
    {
        shutdown();
    }

    /** Close all destinations*/
    public void shutdown()
    {
        logger.unsetLogTargets();
    } 

this will fix the AvalonLogSystem problem, and the changes suggested in 
VELOCITY-78 will fix the Log4jLogSystem problem.

once my patch for VELOCITY-403 is committed, i'll provide patches for these 
problems.  or, if an update of my patch for VELOCITY-403 is required by the 
committers, i will simply include these fixes within that.

> velocityEngine.init opens velocity.log multiple times
> -----------------------------------------------------
>
>          Key: VELOCITY-157
>          URL: http://issues.apache.org/jira/browse/VELOCITY-157
>      Project: Velocity
>         Type: Bug
>   Components: Source
>     Versions: 1.3.1-rc2
>  Environment: Operating System: All
> Platform: PC
>     Reporter: Hendrik Brummermann
>     Priority: Critical
>      Fix For: 1.5
>  Attachments: Test.java
>
> velocityEngine.init opens velocity.log multiple times   Every call to 
> velocityEngine.init() opens velocity.log several times. Frequent calls to 
> .init() (e.g. in doGet/doPost) will use up all file descriptors of the 
> operation system.  This is a critical problem because Windows 2000 deletes 
> all files that a process wants to open after Windows has no more file 
> descriptors left. (On Windows NT 4.0 you get "Too many open files" and 
> nothing is deleted)   Steps to reproduce: 1. java Test (see attachment) 2. 
> While Test is still running do:  a) GNU/Linux: lsof | grep velocity.log|wc -l 
>  b) Windows: handle | find "velocity.log"  (You can get handle.exe from 
> http://www.systeminternals.com)   Expected Result: velocity.log should be 
> opened one or a few times.  Actual Result: velocity.log is opened 900 times 
> (9 times per call to "init").

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to