https://bz.apache.org/bugzilla/show_bug.cgi?id=59859

--- Comment #6 from Coty Sutherland <csuth...@redhat.com> ---
OK, after a lot of poking around I think I found a solution :D

I figured out that the problem was with a FileInputStream. Tomcat7 doesn't use
FIS' in the webresources package, but tomcat8+ does. I determined this by
noticing that that the file handle was hanging around (via lsof) after the MOVE
call is made. Then I took a look at a heap dump taken after the issue (before a
GC removed the reference) and found the FIS object in a Finalizer. After that,
I started in the move method and stepped through the method with jdb while
periodically running lsof to see when the handle was created. This led me to
java/org/apache/catalina/servlets/WebdavServlet.java:1679 where a FIS was being
retrieved from the resource, but not closed. My patch drops the FIS into a
variable and then adds a close call after the write method is invoked to remove
the handle. I don't think the write method should close the FIS since the FIS
din't originate within the write method, which is why I put the close after the
write returned. 

I verified that this doesn't leave a handle open on linux and that the move
operation from my reproduction steps works on both linux and windows after the
patch is applied.

Please review and provide feedback.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to