[JIRA] [core] (JENKINS-22050) All extension classes are loaded at once when any is called

2 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Nov 18, 2015, 3:31:01 PM11/18/15
to jenkinsc...@googlegroups.com
Jesse Glick commented on Bug JENKINS-22050
 
Re: All extension classes are loaded at once when any is called

I think some plugins rely on this unfortunate behavior, making changing it a potential compatibility issue.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

kk@kohsuke.org (JIRA)

unread,
Mar 28, 2016, 12:19:01 PM3/28/16
to jenkinsc...@googlegroups.com

To me, the fact that all extensions are loaded & instantiated is a feature that brings predictability to the boot sequence. Given that Jenkins is a server application, I like that when Jenkins boots up I know all the components are functioning. Imagine the opposite; Jenkins claims it came up OK, but when I run a matrix project, it blows up trying to list Axis extension points, because one of the plugins I have is missing a dependency.

The problem IMHO is that we have this unnecessary unpredictability today that we don't load extensions until someone tries to look at some extensions for the first time. This is a significant enough event that it should be even explicitly defined as an InitMilestone.

Also, the bug description lacks what the problem is. The performance tag seems to tell me that Jesse thinks this is a startup performance problem, but I thought loading extensions is usually a tiny part of it. Isn't this more of a diagnosability problem?

jglick@cloudbees.com (JIRA)

unread,
Mar 28, 2016, 1:37:02 PM3/28/16
to jenkinsc...@googlegroups.com

I am concerned here about startup performance, not diagnosability.

when I run a matrix project, it blows up trying to list Axis extension points

Well it should not “blow up”, it should simply skip over unloadable extension points with a warning, as currently happens during startup.

one of the plugins I have is missing a dependency

That issue is better handled directly by the plugin manager.

kk@kohsuke.org (JIRA)

unread,
Mar 28, 2016, 2:27:01 PM3/28/16
to jenkinsc...@googlegroups.com

But you get the point, right? As an user, I'd rather find problems earlier than later. If one of the extension points do not load, have a problem initializing, or whatever, I'd rather see that error during the boot, not when some code actually attempts to use it.

jglick@cloudbees.com (JIRA)

unread,
Mar 28, 2016, 2:29:01 PM3/28/16
to jenkinsc...@googlegroups.com

I thought loading extensions is usually a tiny part of it

My preliminary results suggest something around 40% given a small $JENKINS_HOME.

Obviously a production instance is going to spend a lot more time loading configuration files, especially jobs. But this is very significant when running tests with JenkinsRule.

jglick@cloudbees.com (JIRA)

unread,
Sep 18, 2019, 8:23:05 AM9/18/19
to jenkinsc...@googlegroups.com

some plugins rely on this unfortunate behavior

It may be possible to mechanically detect these cases: if the extension class has a declared constructor or a static initializer, then we must assume that was intended as an implicit @Initializer (though we could issue a warning that it would be better made explicit).

Of course doing such a check at runtime requires loading, if not fully resolving, the class, which is what we hope to avoid. That is just a small portion of the general problem that when someone asks for the ExtensionList of a particular supertype, we would like to be able to efficiently enumerate all subtypes with @Extension, which is not something we currently have static metadata for (since Jenkins did not use SezPoz as it was designed).

We could try to build a cache of this information after starting up with all extensions loaded, so that the next startup will be faster. This does not help JenkinsRule, though, and requires the cache to be invalidated based on the set of enabled plugins and their versions.

We could stop using SezPoz for @Extension and instead define custom processor which records supertypes, and try to get plugins released which are built against this system. Means that any older plugins will still get all their extensions loaded eagerly.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages