-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Performance impact of con.getContentLengthLong() in AbstractFileResolvingResource.isReadable() downloading huge jars to check component length #27541
Comments
On review, the The 5.1 revision was meant for static web resources where those additional checks provide value for testing whether a specific resource path can be served. In the context of classpath scanning, the tradeoff is quite different since we process resources coming from a |
Closed through 715f300 (unfortunately with a typo in the issue number in the commit message). |
Thanks for the quick review and resolution @jhoeller . Will you be backporting to 5.2.x? If yes could you please share the version it should be included in? |
I'm in the process of backporting it to 5.2.18, will be creating a backport issue on GitHub in a moment... |
This is available in the latest 5.3.11 snapshot now and will be available in the upcoming 5.2.18 snapshot as well. Feel free to give it an early try... |
Affects: Spring Framework 5.2.9
Change causing the issue: 69f14a2
The above change added content length check to the
AbstractFileResolvingResource.isReadable()
method. That introduced performance impact on using webstart.For URL connections over Internet (and not on file system), if the context-scan involves component scan for certain packages, and those packages are inside a jar then that blocks the thread.
Jar is downloaded as many times as there are components appearing in packages meant to be scanned in XML file.
EXAMPLE:
Consider this:
<context:component-scan base-package="com.spring.test" />
Now if I have a 1gb jar (say, test.jar) with the above package in my application,
I have a jnlp file with
<jar main="false" href="jars/test.jar"/>
, andtest.jar
has lets say 50 classes in the packagecom.spring,test
; then when starting the jnlp application for the first time, spring scans for components and as the jar is hosted over the internet (not available in cache for the first time) , spring downloads it 50 times and the thread is in runnable state for a long time thus not allowing other applications to connect to the server hosting the webstart application.Can we make the con.getContentLengthLong() optional??
SAMPLE RUNNABLE THREAD:
The text was updated successfully, but these errors were encountered: