[GitHub] [tomcat] blueSky1825821 commented on pull request #368: fix: CachedResource add path length
blueSky1825821 commented on pull request #368: URL: https://github.com/apache/tomcat/pull/368#issuecomment-707629467 > I've done some calculations and the absolute upper limit (the actual upper limit will be lower) is that a cache with a 10MB limit on size will actually use a little under 175MB. That isn't great but it isn't terrible either. I'll tweak the resource size calculation so it includes an approximate of the memory required to store the path. > The proposed patch has a couple of issues: > > * It converts the string to bytes to determine the size. This is both expensive and wrong. String length *2 +38 is a much closer approximation and I intend to ignore the 38 as that is already accounted for in the 500 byte overhead for each entry. > * It includes the path size when determining if the resource exceeds the max object size (and hence won't have the content cached) but does not include the path size when performing the same check to determine when deciding whether to cache the content or not. > > I should have a fix for this committed shortly. Let me add that, after jdk8, e.g jdk9 String has been changed private final char value[]; --> private final byte[] value; but length *2 is also fine This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] blueSky1825821 commented on pull request #368: fix: CachedResource add path length
blueSky1825821 commented on pull request #368: URL: https://github.com/apache/tomcat/pull/368#issuecomment-700585098 > > What is the justification for this change? What problem does it solve? > > When our application is loaded in another path or attacked in an unknown way, webapp path could take up a lot of space(a few megabytes). > org.apache.catalina.webresources.Cache#resourceCache can't be cleaned up, this happens in a production environment This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GitHub] [tomcat] blueSky1825821 commented on pull request #368: fix: CachedResource add path length
blueSky1825821 commented on pull request #368: URL: https://github.com/apache/tomcat/pull/368#issuecomment-700584396 > What is the justification for this change? What problem does it solve? When our application is loaded in another path or attacked in an unknown way, webapp path could take up a lot of space. org.apache.catalina.webresources.Cache#resourceCache can't be cleaned up, this happens in a production environment This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org