Bug 68054 - DirResourcesSet: getCanonicalPath is very slow in windows
Summary: DirResourcesSet: getCanonicalPath is very slow in windows
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.50
Hardware: PC All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-02 12:49 UTC by Vicente Rossello
Modified: 2023-11-02 14:21 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vicente Rossello 2023-11-02 12:49:27 UTC
Noticed in windows, with tomee and jsf in DEVELOPMENT stage.

When JSF is in DEVELOPMENT mode, every facelet file is refreshed on every access. This is very slow in windows, as you can see in this thread: https://www.mail-archive.com/users@tomee.apache.org/msg17957.html . (we had the same problem but never reported)

The problem is that DirResourcesSet is checking constantly this canonicalPath. The problem is solved by setting allowLinking=true in context.xml.

One obvious workaround is to avoid checking two times the same getCanonicalPath in:

                                if (entry.getCanonicalPath().length() >= f.getCanonicalPath().length()) {
                                    canPath = entry.getCanonicalPath().substring(f.getCanonicalPath().length());

This way time would be halved.


Another option is maybe to document the problem or produce a log warning if windows, jsf in development mode and allowLinking=false?


I'm unable to provide a simple reproducer as it requires tomcat with jsf and a xhtml with some includes/custom components/tag handlers.
Comment 1 Jens Zurawski 2023-11-02 13:17:05 UTC
I'm the one initially started the thread in the tomee mailing list. Just some additional infos from me:

To see some benchmark figures of how big the impact can be on a windows system, please take a look into this mail from the mentioned thread:
https://www.mail-archive.com/users@tomee.apache.org/msg17986.html

The impact is really that bad, that it renders the JSF DEVELOPMENT mode unusable, at least with big views.

If there are no other options to solve this issue, at least a warning somewhere would be really beneficial, because it is hard for a user to understand why it is so slow and that it can be worked around with allowLinking="true"

I've checked many revisions of tomee and found out that this behaviour was starting with the change from tomcat 9.0.48 to 9.0.50
Comment 2 Remy Maucherat 2023-11-02 14:05:59 UTC
These checks are needed, feel free to post on the user mailing list for further help.
Ok for optimizing https://github.com/apache/tomcat/commit/de69069ae4c847165a9f68754faf02dbc106b21d but it is a very recent commit.
Comment 3 Remy Maucherat 2023-11-02 14:21:08 UTC
The optimization will be in 11.0.0-M14, 10.1.16, 9.0.83 and 8.5.96.