raul_arabaolaza found that the /pluginManager/available page is slow to render, causing timeouts in ATH (JENKINS-50790), and that this became especially bad as of 2.112. That seems to have been caused by the JENKINS-22367 split of jdk-tool at that time. Example thread dump:
"Handling GET /pluginManager/available from 127.0.0.1 : RequestHandlerThread[#12] PluginManager/available.jelly" ... runnable ...
java.lang.Thread.State: RUNNABLE
at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:242)
at java.io.File.exists(File.java:819)
at hudson.util.TextFile.exists(TextFile.java:60)
at hudson.model.UpdateSite.getData(UpdateSite.java:322)
at hudson.model.UpdateSite.getPlugin(UpdateSite.java:382)
at hudson.model.UpdateCenter.getPlugin(UpdateCenter.java:612)
at hudson.model.UpdateSite$Plugin.getNeededDependencies(UpdateSite.java:1030)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1112)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
at hudson.model.UpdateSite$Plugin.isNeededDependenciesCompatibleWithInstalledVersion(UpdateSite.java:1113)
It seems that there are two problems:
- Every call to getData is checking a file timestamp, causing a lot of I/O, which is silly since the Jenkins master is in control of reading and writing this file so it can just keep information in memory.
- Some of the methods called from table.jelly can involve deep recursion, especially when detached plugins are involved.