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
[JENKINS-68339] Skip remoting stack on built-in node and improve IPv6 Regex #366
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Future<V> future; | ||
// If running in on the built-in node, no need to use the CallAsyncWrapper or be subjected | ||
// to the REMOTE_OPERATION_TIMEOUT_MS | ||
if (node instanceof Jenkins) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be safer to call JenkinsJVM.isJenkinsJVM()
if this might run on an agent? Not sure if node instanceof Jenkins
will trigger classloading of the main Jenkins
class on agents (which would be undesirable).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AsyncResultCache actually always executes on the controller JVM. It accepts the node and the callable and then kind of delegate the asynchronous execution and just retrieve the result. So here we check if the node in which we are going to execute the callable is the controller or not.
Maybe I can rephrase my comment.
Still failing with the timeout though 🤔 I can't reproduce wth JDK 17 locally on my machine (MBP 2019 32 GB RAM). I captured a thread dump programmatically on TimeoutException and we seem to spend time on com.cloudbees.jenkins.support.filter.InetAddressContentFilter.filter:
|
That regexp for IPv6 sure is taking a toll.. I have tested others like the one from the Regular Expression Cookbook:
But it is also kind of slow. The one from http://www.java2s.com/example/java/java.util.regex/is-ipv6-address-by-regex.html seems promising and simpler:
Will do more test. but this is most likely the better solution to the problem we are trying to solve. |
I realized that regexp for IPv6 addresses at https://github.com/jenkinsci/support-core-plugin/blob/1162.vb_b_e5198c6b_22/src/main/java/com/cloudbees/jenkins/support/filter/InetAddressContentFilter.java#L61 is not even capturing all IPv6. It misses the compressed and mixed addresses... And above all, it is terribly slow... I am updating tests that reflect this. And will then update a solution that seem promising. |
Those tests shows that the current regex does not find valid IPv6 compressed addresses like:
But also notice how the test take seconds in JDK 11 and more than a minute on JDK 17.. Now pushing an improved regex to solve all this.. |
Now all the tests run in <1s. And the tests covers many more IPv6 syntaxes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
I also tested this in different environments and that looks good. And seems to be reducing the generation time when anonymization is on. |
JENKINS-68339
channel.callAsync
(through theCallAsyncWrapper
) if retrieving data on remote node. When retrieving data on the built-in node, just execute the callable.I am hoping that this fix the flakyness with JDK 17 as we remove the remoting overhead for this use case. See the following for reference: