Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-dev] Resource leak with URLResource?

Hi,

Sorry ...

* Jetty: 9.2.9.v20150224
* Java 8 (OpenJDK and Oracle 1.8.0_45)
* OS: Linux 32/64 bit, CentOS 6.4, Linux Mint 17.1

Jens

On 04/29/2015 02:47 PM, Joakim Erdfelt wrote:
Which version of Jetty, what version of Java, and on what OS?

--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
Expert advice, services and support from from the Jetty & CometD experts

On Wed, Apr 29, 2015 at 4:02 AM, Jens Reimann <jens.reimann@xxxxxxxxxxxxxxx> wrote:
Hi,

I am just checking out a file handle leak with Jetty running in an OSGi
setup.

I do provide a custom "WebAppContext" which overrides getResource (…)
and returns Resource instances (created using Resource.newSource())
which are URL based and internally create a URLResource.

However doing so will cause the resources to be opened, but never closed
by the Jetty Servlet infrastructure.

I think the cause for this is in the method "URL
WebAppContext.Context.getResource(String path)". Which:
a) first it gets a resource
b) calls Resource.exists() -> which opens a stream for a URLResource
c) returns the URL by .getURL()
d) never closes the resource using Resource.close ();

This will work with FileResource instances since these implement exist
without actually opening the file. But on a URLResource most operations
do open a connection which has to be closed.

Thanks for your help

Jens

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev



_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-dev



Back to the top