Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCache Parser configurers when running on a slave #2806
Conversation
Reasoning: applyConfiguration() invokes RPC when running on slave. -> parsing 1000s XML files results in 1000s of RPCs.
|
There is no JIRA issue because I don't have an account yet. I created the account today but I have not received a password yet. |
|
I am not sure if eternal caching is desired. I will be happy to introduce some TTL if needed. I believe the Parser Configurers abstraction is used for TestNG tests only. |
|
this PR could resolve https://issues.jenkins-ci.org/browse/JENKINS-10175 |
|
@kuisathaverat Seems unrelated, the problem there is more likely a too permissive ant pattern/too large workspace. Notably |
|
@daniel-beck: I agree the JENKINS-10175 looks somewhat differently. This is the stacktrace I am observing during the lengthy result processing:
|
|
I would like to discuss the plugin Dynamic loading case before we go forward with such approach. P.S: This also an example of a serializable extension point, which would generally prefer to avoid. Not related to this change |
| } | ||
| }); | ||
| if (Jenkins.getInstanceOrNull() == null) { | ||
| all = fromCacheOrRemote(); | ||
| } else | ||
| all = all(); |
This comment has been minimized.
This comment has been minimized.
|
|
||
| private static Collection<ParserConfigurator> fromCacheOrRemote() throws IOException, InterruptedException { | ||
| if (cache != null) { | ||
| return cache; |
This comment has been minimized.
This comment has been minimized.
oleg-nenashev
Mar 16, 2017
Member
Such approach won't work reliably, e,g, if a new plugin with ParserConfigurator gets dynamically loaded. Without cache invalidation logic in may become error-prone
This comment has been minimized.
This comment has been minimized.
jerrinot
Mar 16, 2017
•
Author
what would you recommend to do? can a slave subscribe to receive informations about plugins loaded on a master? or is a simple time-to-live enough?
This comment has been minimized.
This comment has been minimized.
jglick
Mar 16, 2017
Member
You can use ExtensionListListener on the master side, but then how would you notify the agent to expire its cache? Could become quite tricky.
This comment has been minimized.
This comment has been minimized.
jerrinot
Mar 16, 2017
•
Author
@jglick: I don't really know Jenkins codebase so I thought there could be a subscribe mechanism.
If there is no such thing then I guess a proper invalidation is difficult. So I can either use a static TTL or completely avoid using the extension mechanism
|
I would suggest deprecating this whole extension point as misconceived from the start, and make the |
| @@ -55,6 +55,7 @@ | |||
| */ | |||
| public abstract class ParserConfigurator implements ExtensionPoint, Serializable { | |||
| private static final long serialVersionUID = -2523542286453177108L; | |||
| private static volatile Collection<ParserConfigurator> cache; | |||
This comment has been minimized.
This comment has been minimized.
jglick
Mar 16, 2017
Member
@Extensions should generally not be cached in a static field, lest the wrong objects carry over from one Jenkins session to the next. If I understand correctly, this field is only used when this class is loaded in an agent JVM, which would be specific to one session, so it is not a problem.
|
|
||
| private static Collection<ParserConfigurator> fromCacheOrRemote() throws IOException, InterruptedException { | ||
| if (cache != null) { | ||
| return cache; |
This comment has been minimized.
This comment has been minimized.
jglick
Mar 16, 2017
Member
You can use ExtensionListListener on the master side, but then how would you notify the agent to expire its cache? Could become quite tricky.
|
The reported stack traces in JENKINS-10175 are unrelated to this optimization. |
|
@oleg-nenashev, @jglick: thanks a lot for your review. Would something like this work better for you? |
|
@daniel-beck I have supposed that the next step of ParserConfigurator should be the parsing process and depends on of when you take the thread dump you could find the stack trace that @jerrinot has posted, also the behavior it is pretty similar. |
|
@jglick @oleg-nenashev on this https://github.com/jenkinsci/junit-plugin/pull/65/files makes the change to XMLEntityResolver for the JUnit Plugin, it is for sure better than a change on core |
|
This PR is now conflicted. Given the last comment was in March 2017, I'm going to propose closing it. I will close this, if nobody disagrees, on the next pass, likely next week. Thanks! |
|
Closing, as per my last comment. @jerrinot please feel free to comment here anytime once/if you feel like getting back to this, and thanks again for the work. We're all happy to reopen anytime it's needed. Thanks! |
|
@batmat: this PR was actually superseded by jenkinsci/junit-plugin#65, I just forgot to close it. sorry, for that! |
|
No worries, thanks again for your involvement! |
jerrinot commentedMar 15, 2017
Description
This changeset caches Parser Configurer(s) when running on a slave.
Details:
applyConfiguration() invokes RPC when running on slave.
-> parsing 1000s XML files results in 1000s of RPCs.
Changelog entries
Proposed changelog entries: