You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by ch...@kiffer.ltd.uk on 2014/10/03 09:10:18 UTC

Open file descriptors

While investigating a resource problem on our server I noticed that Karaf
(using Felix) had an open file descriptor on every
data/cache/bundle*/version* file (i.e. the cached bundle). Does anyone
know if this is normal behaviour for Karaf, Felix, or indeed OSGi
frameworks in general?



Re: Open file descriptors

Posted by ch...@kiffer.ltd.uk.
Thanks Guillaume, this is exactly the information I needed!


> I think this is the expected behavior for Felix at least, though I've no
> idea how other OSGi frameworks work internally.
> This is controlled by
>
> https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
> and also
>
> https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/util/WeakZipFileFactory.java
>
> The WeakZipFileFactory can be configured to only keep a number of zip
> files
> opened at the same time, so it's a tradeoff between performances and
> resources.
> It can be configured using the felix.cache.filelimit property
>
> https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java#L82
> The default value is 0, meaning all files will be kept opened.
>
>
> 2014-10-03 9:10 GMT+02:00 <ch...@kiffer.ltd.uk>:
>
>> While investigating a resource problem on our server I noticed that
>> Karaf
>> (using Felix) had an open file descriptor on every
>> data/cache/bundle*/version* file (i.e. the cached bundle). Does anyone
>> know if this is normal behaviour for Karaf, Felix, or indeed OSGi
>> frameworks in general?
>>
>>
>>
>



Re: Open file descriptors

Posted by Guillaume Nodet <gn...@apache.org>.
I think this is the expected behavior for Felix at least, though I've no
idea how other OSGi frameworks work internally.
This is controlled by

https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/cache/JarContent.java
and also

https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/util/WeakZipFileFactory.java

The WeakZipFileFactory can be configured to only keep a number of zip files
opened at the same time, so it's a tradeoff between performances and
resources.
It can be configured using the felix.cache.filelimit property

https://github.com/apache/felix/blob/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java#L82
The default value is 0, meaning all files will be kept opened.


2014-10-03 9:10 GMT+02:00 <ch...@kiffer.ltd.uk>:

> While investigating a resource problem on our server I noticed that Karaf
> (using Felix) had an open file descriptor on every
> data/cache/bundle*/version* file (i.e. the cached bundle). Does anyone
> know if this is normal behaviour for Karaf, Felix, or indeed OSGi
> frameworks in general?
>
>
>