Bug 63983 - Jasper builds-up open files until garbage collection, hitting Linux default limit of 4096.
Summary: Jasper builds-up open files until garbage collection, hitting Linux default l...
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 9.0.29
Hardware: PC Linux
: P2 critical with 1 vote (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
: 64857 (view as bug list)
Depends on:
Reported: 2019-12-03 04:39 UTC by Dan Armstrong
Modified: 2020-11-13 16:17 UTC (History)
1 user (show)


Note You need to log in before you can comment on or make changes to this bug.
Description Dan Armstrong 2019-12-03 04:39:52 UTC
Starting with Tomcat 9.0.29 (but not 9.0.27, and fixed by reverting), the Java process builds-up open files until hitting the Linux default limit of 4096.

lsof shows that the files are all those that would be checked when determining if a JSP file needs to be recompiled (the JSP file, its includes, and all related *.tld files).

With "development=true" (the default), the files build-up in proportion to the request load.  With "development=false", the files build-up more consistently (around 100 files every 10 seconds in our case).

When a garbage collection occurs, the open file count drops back to around 100.

With our heap-space of 1024 MB, combined with some include-heavy JSP pages, we run out of file handles before garbage collection, and requests fail with errors.

We increased the limits in /etc/security/limits.conf as a workaround, but the fix was to downgrade to Tomcat 9.0.27.
Comment 1 Mark Thomas 2019-12-03 12:49:03 UTC
Thanks for the report. This is another regression in the fix for the race condition in JSP compilation that meant Jasper would see a modified JSP but then process stale content for that file from the static resource cache.

I think I can address this with my favourite kind of fix (deleting some code) but I want to run a few more tests before I commit the fix.
Comment 2 Mark Thomas 2019-12-03 13:14:28 UTC
Fixed in:
- master for 9.0.30 onwards
- 8.5.x for 8.5.50 onwards
Comment 3 Dan Armstrong 2020-01-15 07:47:06 UTC
I have confirmed this issue is resolved during our updates to Tomcat 9.0.30.  Thank you for your help.
Comment 4 Mark Thomas 2020-11-13 16:17:28 UTC
*** Bug 64857 has been marked as a duplicate of this bug. ***