You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Florian Trimmel <fl...@gmail.com> on 2019/05/23 10:59:40 UTC

Migration from Tomcat 7 to 9 results in more open file descriptors

Hi,



After migrating from Tomact 7 to Tomcat 9.0.20 (running with same Java
Version 1.8.0_25) we have a problem with our JSF2 web application on Linux
RHEL 7. After some time we get Exceptions like this:



java.io.FileNotFoundException:
/f4m/tomcat/tomcat_f4mbs/webapps/ACM/WEB-INF/acm-config.xml (Too many open
files)

    at java.io.FileInputStream.open0(Native Method)

    at java.io.FileInputStream.open(FileInputStream.java:195)

    at java.io.FileInputStream.<init>(FileInputStream.java:138)

    at java.io.FileInputStream.<init>(FileInputStream.java:93)





After searching around a while, I have found out that there are many open
file descriptors to xhtml files, by executing this command (where 4025 is
the Tomcat process ID):



ls -l /proc/4025/fd





lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 238 ->
/usr/java/jdk1.8.0_25/jre/lib/resources.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 239 -> pipe:[3661823]

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 24 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/websocket-api.jar

l-wx------. 1 f4mHttp f4mHttp 64 May 16 09:01 240 -> pipe:[3661823]

lrwx------. 1 f4mHttp f4mHttp 64 May 16 09:01 241 -> anon_inode:[eventpoll]

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 243 -> pipe:[3661824]

l-wx------. 1 f4mHttp f4mHttp 64 May 16 09:01 244 -> pipe:[3661824]

lrwx------. 1 f4mHttp f4mHttp 64 May 16 09:01 245 -> anon_inode:[eventpoll]

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 246 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 247 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml

lrwx------. 1 f4mHttp f4mHttp 64 May 16 09:01 248 -> socket:[3667364]

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 249 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/searchpage.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 25 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/jasper.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 250 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/searchpage.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 251 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalheader.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 252 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/customizing/nav/menu.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 253 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 254 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/nav/bottomPanel.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 255 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/nav/bottomPanel.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 256 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:01 257 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 258 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 259 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 26 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/ecj-4.9.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 260 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 261 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 262 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/common/barcodefunction_incl.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 263 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalfooterAll.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 264 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartner.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 266 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartner.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 267 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/nav/portalheader.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 268 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/portal/customizing/nav/menu.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 27 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/catalina-ha.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 274 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartner_topnav.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 275 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 276 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/msgBox.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 277 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 278 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 279 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 28 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/jsp-api.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 280 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 281 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 282 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 283 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 286 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 287 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 288 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 289 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 29 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/annotations-api.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 290 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 291 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 292 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 293 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartnerparent_incl.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 294 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 295 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 296 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 297 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 298 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartnerHierarchySimilarAddresses.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 299 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartnerchild_incl.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 3 ->
/usr/java/jdk1.8.0_25/jre/lib/rt.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 30 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/tomcat-i18n-fr.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 300 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 301 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 302 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 303 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 304 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/form/partner/crmpartnerHierarchySimilarAddresses.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 305 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 306 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 307 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 308 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 309 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 31 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/tomcat-coyote.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 310 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 311 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 312 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 313 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 314 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 315 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 316 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 317 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 318 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 319 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 08:58 32 ->
/f4m/tomcat/tomcat_f4mbscrm/lib/catalina-ant.jar

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 320 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 321 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 322 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 323 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 324 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 325 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 326 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 327 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 328 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml

lr-x------. 1 f4mHttp f4mHttp 64 May 16 09:02 329 ->
/f4m/tomcat/tomcat_f4mbscrm/webapps/ACM/resources/components/calendar.xhtml





This is not the complete list - there are many more.



The number of listed files goes up and down. For me it seems that xhtml (or
one of its used components) has an open file descriptor as long as a page
is shown in Browser.



I already know how to increase the maximum number of open file descriptors,
what bothers me is that if I deploy the same application on Tomcat 7 again,
I can only see open file descriptors for JAR Files, Sockets, but NEVER for
xhtml's.



Can someone please explain why this happens?



Thanks

Re: Migration from Tomcat 7 to 9 results in more open file descriptors

Posted by Mark Thomas <ma...@apache.org>.
On 03/06/2019 22:46, Mark Thomas wrote:
>> Florian,
>>
>>> On 5/23/19 06:59, Florian Trimmel wrote: We were able to figure out
>>> what was causing the file descriptor leak.
>>
>>> The leak has occured in the JSF2 MyFaces Implementation we are
>>> using. It is described here:
>>> https://marc.info/?l=myfaces-dev&m=152536956716792&w=2 The problem
>>> was found using this tool: http://file-leak-detector.kohsuke.org/
>>
>> Yup, that'll do it.
>>
>> Thanks for coming back to report your results.
> 
> +1.
> 
> This got me thinking. We should add a debugging section to the Wiki and
> include this tool.

Done:
https://cwiki.apache.org/confluence/display/TOMCAT/Debugging

Additional content welcome.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Migration from Tomcat 7 to 9 results in more open file descriptors

Posted by Mark Thomas <ma...@apache.org>.
> Florian,
> 
>> On 5/23/19 06:59, Florian Trimmel wrote: We were able to figure out
>> what was causing the file descriptor leak.
> 
>> The leak has occured in the JSF2 MyFaces Implementation we are
>> using. It is described here:
>> https://marc.info/?l=myfaces-dev&m=152536956716792&w=2 The problem
>> was found using this tool: http://file-leak-detector.kohsuke.org/
> 
> Yup, that'll do it.
> 
> Thanks for coming back to report your results.

+1.

This got me thinking. We should add a debugging section to the Wiki and
include this tool.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Migration from Tomcat 7 to 9 results in more open file descriptors

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Florian,

> On 5/23/19 06:59, Florian Trimmel wrote: We were able to figure out
> what was causing the file descriptor leak.
> 
> The leak has occured in the JSF2 MyFaces Implementation we are
> using. It is described here:
> https://marc.info/?l=myfaces-dev&m=152536956716792&w=2 The problem
> was found using this tool: http://file-leak-detector.kohsuke.org/

Yup, that'll do it.

Thanks for coming back to report your results.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlz1kpIACgkQHPApP6U8
pFifABAAj3rtiX284coPU1v6lxIA+Xyh7+YBdboS4bOjXBDL3zszIPO8Emwja5Q6
N5zdu1HL48uL/PaYbb4WdhErne7H9116wVM3VJRGEbYDN2QFXm/EawnBQqhET1A6
zk+IFUDpzQYoQUu9ZOjJZlCrlShxzn45YrD9W8AU1lhBCxxDJqKoNQ8hL0kXQNTX
xKZ4ex5xd+nawzap1In7KpsTewAC/X46N6Q4FPbb8N8tArLXdL9ZDg/sBPdQ/JnZ
cIt+L5lorw2OqmTmawXWOK+JN09vY6yaCbZrzt4+PlkVdgP179znkxBc0DLS5/+z
2W/SpGhnuB4LePiu7ISRajYchfwsk338jxXKuUqhFtD+r4BwODWWFdGsdo0GyVk2
dLx7VWIAieJzZng+CyTiayJKYmw6SxslKzEfNFFR5gfqwitKfFUUjtTbB4cLATWR
vrgCyQJGevNMnMYmHPpeiZKBsxfe4psJY5seZ2X9zjb0Y+jKSpGnbheBJ17sah0W
HJvXs8QdR4PEDn6pumpSyFr6k5j6uw6/W++rLRhZVCZcFBDdZFuvjb/qgKS4C8/n
7tqBn1E4iWiTqTaIIfd8H6s5dti8eDFMOqx1wxKREb8fFA1bGJsLEW4zBH25iBCK
g6jiywtDaDXkjLIUrvpiuxBmWEJ0pCGDcv8daHx5mZuWgiFe0JY=
=DN0D
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Migration from Tomcat 7 to 9 results in more open file descriptors

Posted by Florian Trimmel <fl...@gmail.com>.
Am Do., 23. Mai 2019 um 17:14 Uhr schrieb Christopher Schultz <
chris@christopherschultz.net>:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Florian,
>
> On 5/23/19 06:59, Florian Trimmel wrote:
> > After migrating from Tomact 7 to Tomcat 9.0.20 (running with same
> > Java Version 1.8.0_25) we have a problem with our JSF2 web
> > application on Linux RHEL 7. After some time we get Exceptions like
> > this:
> >
> >
> >
> > java.io.FileNotFoundException:
> > /f4m/tomcat/tomcat_f4mbs/webapps/ACM/WEB-INF/acm-config.xml (Too
> > many open files)
> >
> > at java.io.FileInputStream.open0(Native Method)
> >
> > at java.io.FileInputStream.open(FileInputStream.java:195)
> >
> > at java.io.FileInputStream.<init>(FileInputStream.java:138)
> >
> > at java.io.FileInputStream.<init>(FileInputStream.java:93)
> >
> >
> >
> >
> >
> > After searching around a while, I have found out that there are
> > many open file descriptors to xhtml files
>
> Do you know if your application opens these files, or are they
> (likely) being opened by Tomcat in response to incoming client
> requests for those files?
>
> > [snip]
> >
> > This is not the complete list - there are many more.
> >
> > The number of listed files goes up and down. For me it seems that
> > xhtml (or one of its used components) has an open file descriptor
> > as long as a page is shown in Browser.
>
> ... and when you close the browser, the fd is closed too? Spooky.
>
> > I already know how to increase the maximum number of open file
> > descriptors, what bothers me is that if I deploy the same
> > application on Tomcat 7 again, I can only see open file descriptors
> > for JAR Files, Sockets, but NEVER for xhtml's.
> >
> > Can someone please explain why this happens?
>
> The obvious explanation would be a fd leak within Tomcat but I see no
> data to support that. The "resources" (aka file-reading)
> implementation changed between Tomcat 7 and 9 and if your application
> is being a little lazy about resource-management, this could cause fds
> to be left open now where they were being cleaned-up for you in the past
> .
>
> Improper caching configuration could also leave file descriptors open,
> but multiple fds open to the same file is the exact opposite of
> caching, so the configuration would have to indeed be particularly bad.
>
> Are you able to attach a profiler to the JVM process? If so, try
> launching Tomcat, attaching the profiler, and then making some
> requests. The profiler ought to be able to show you where certain
> objects were allocated and you can track-down where e.g.
> FileInputStream objects are created. If they are being created in
> Tomcat's code without being called from your application (e.g. from
> within DefaultServlet), then something is very wrong.
>
> But at this point, the new resources implementation is fairly mature
> and I wouldn't expect it to leak like this.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/
>
> iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzmuOUACgkQHPApP6U8
> pFgqwg/9FUmsAS/mOin0NKIlU1LOPRyf72/gT+8n5vyquC+CBk8jWFBqxNFZEoGV
> Fc+5rfwF1pqK8aTgDM2dzEb4bJ9s3sVGY/SLvspGyeRU81/uqZW4CnSGIL7VzrJk
> xpTi4hk02rNFbq8yNjMDqCUx2t41Bi8NUVJh9TUtHRPZRQWhy3JsG32HQdPrPklj
> AipBl/NkpizGZQlAGqMz87rYvFIEz1e1hA47CPfUFg7x8WCib7X9JcHHZYF5gQjS
> y/h5IdRT9A6F1Lu2arW00cFPSfoYoZA+gHWzQMGHmTXSQplwzF8h9tafNLXf4u4u
> Knav+K3KTPeskzuKUqxLTa2GwX6MNLnEnw3uicvuHT13JYncLTz6LCgSE31/xgj9
> EcnME4zQca7X14DrHaldwwejuvqL/HYTVkYc6YOt24E3FCAbkcPg8MOYo1QjT408
> u1GXl+n4HBgNsHO//FsAVYDEm14YXmvWyB+33aVc9OKbCk1X+vRbkq8Fe//Bz05T
> 72Mb5potJWGFhHVseSuiYp1XyhlgSWDqzQkqoYV8ffm5ecfbYd96gRqFxveK0S2I
> 9/9X6k8a/6lqQMidfNoqKfoA1G+5soI436j6LYlna4vqIgB+ZjCoTmnzJh4+NMy7
> VcAZ+S2uRb3bnTccsttcNbCKOM9BD9C9rSosS3N48XDl3u5ooL4=
> =B0WJ
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Christopher,
Thank you for your quick reply
We were able to figure out what was causing the file descriptor leak.

The leak has occured in the JSF2 MyFaces Implementation we are using.
It is described here: https://marc.info/?l=myfaces-dev&m=152536956716792&w=2
The problem was found using this tool:
http://file-leak-detector.kohsuke.org/


Thanks,
Florian

Re: Migration from Tomcat 7 to 9 results in more open file descriptors

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Florian,

On 5/23/19 06:59, Florian Trimmel wrote:
> After migrating from Tomact 7 to Tomcat 9.0.20 (running with same
> Java Version 1.8.0_25) we have a problem with our JSF2 web
> application on Linux RHEL 7. After some time we get Exceptions like
> this:
> 
> 
> 
> java.io.FileNotFoundException: 
> /f4m/tomcat/tomcat_f4mbs/webapps/ACM/WEB-INF/acm-config.xml (Too
> many open files)
> 
> at java.io.FileInputStream.open0(Native Method)
> 
> at java.io.FileInputStream.open(FileInputStream.java:195)
> 
> at java.io.FileInputStream.<init>(FileInputStream.java:138)
> 
> at java.io.FileInputStream.<init>(FileInputStream.java:93)
> 
> 
> 
> 
> 
> After searching around a while, I have found out that there are
> many open file descriptors to xhtml files

Do you know if your application opens these files, or are they
(likely) being opened by Tomcat in response to incoming client
requests for those files?

> [snip]
> 
> This is not the complete list - there are many more.
> 
> The number of listed files goes up and down. For me it seems that
> xhtml (or one of its used components) has an open file descriptor
> as long as a page is shown in Browser.

... and when you close the browser, the fd is closed too? Spooky.

> I already know how to increase the maximum number of open file
> descriptors, what bothers me is that if I deploy the same
> application on Tomcat 7 again, I can only see open file descriptors
> for JAR Files, Sockets, but NEVER for xhtml's.
> 
> Can someone please explain why this happens?

The obvious explanation would be a fd leak within Tomcat but I see no
data to support that. The "resources" (aka file-reading)
implementation changed between Tomcat 7 and 9 and if your application
is being a little lazy about resource-management, this could cause fds
to be left open now where they were being cleaned-up for you in the past
.

Improper caching configuration could also leave file descriptors open,
but multiple fds open to the same file is the exact opposite of
caching, so the configuration would have to indeed be particularly bad.

Are you able to attach a profiler to the JVM process? If so, try
launching Tomcat, attaching the profiler, and then making some
requests. The profiler ought to be able to show you where certain
objects were allocated and you can track-down where e.g.
FileInputStream objects are created. If they are being created in
Tomcat's code without being called from your application (e.g. from
within DefaultServlet), then something is very wrong.

But at this point, the new resources implementation is fairly mature
and I wouldn't expect it to leak like this.

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAlzmuOUACgkQHPApP6U8
pFgqwg/9FUmsAS/mOin0NKIlU1LOPRyf72/gT+8n5vyquC+CBk8jWFBqxNFZEoGV
Fc+5rfwF1pqK8aTgDM2dzEb4bJ9s3sVGY/SLvspGyeRU81/uqZW4CnSGIL7VzrJk
xpTi4hk02rNFbq8yNjMDqCUx2t41Bi8NUVJh9TUtHRPZRQWhy3JsG32HQdPrPklj
AipBl/NkpizGZQlAGqMz87rYvFIEz1e1hA47CPfUFg7x8WCib7X9JcHHZYF5gQjS
y/h5IdRT9A6F1Lu2arW00cFPSfoYoZA+gHWzQMGHmTXSQplwzF8h9tafNLXf4u4u
Knav+K3KTPeskzuKUqxLTa2GwX6MNLnEnw3uicvuHT13JYncLTz6LCgSE31/xgj9
EcnME4zQca7X14DrHaldwwejuvqL/HYTVkYc6YOt24E3FCAbkcPg8MOYo1QjT408
u1GXl+n4HBgNsHO//FsAVYDEm14YXmvWyB+33aVc9OKbCk1X+vRbkq8Fe//Bz05T
72Mb5potJWGFhHVseSuiYp1XyhlgSWDqzQkqoYV8ffm5ecfbYd96gRqFxveK0S2I
9/9X6k8a/6lqQMidfNoqKfoA1G+5soI436j6LYlna4vqIgB+ZjCoTmnzJh4+NMy7
VcAZ+S2uRb3bnTccsttcNbCKOM9BD9C9rSosS3N48XDl3u5ooL4=
=B0WJ
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org