-
-
Notifications
You must be signed in to change notification settings - Fork 273
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-59094] Jenkins connection failure with tunneling #345
Conversation
Adjust the logic for parsing the tunneling host:port to match what it used to bebefore the latest release.
Hi! I have a pretty similar problem but in my case the HOST is empty. This line suggests that the tunnel string, on some point in code, is auto-completed: remoting/src/main/java/hudson/remoting/jnlp/Main.java Lines 70 to 74 in 58588ea
However, this is not done up to this point, where the failure happens: remoting/src/main/java/org/jenkinsci/remoting/engine/HostPort.java Lines 17 to 24 in bdfcda0
I currently don't have time to investigate into it further, but at some point later in code, there must have happened some kind of auto-completion. Unfortunately, I also haven't figured out where the tunnel is set at all, because I'm not sure where this jelly is located in the UI. BR, Edit: phrasing |
Only the separator needs to be provided. Jenkins magic strikes again.
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.
Changes LGTM. No manual testing done by myself.
This should get the parsing back to the state it was before, which should resolve [JENKINS-59094] and the related issue reported above by @bbara. I haven't been able to reproduce or test these other scenarios. It would be great if someone else with those setups could give it a try. |
I currently have limited access to my Jenkins instance but I will provide feedback asap. Some more findings: |
Does not work for me:
So for my case, it seems like the server name/HOST got lost somewhere. However, I found the advanced setting to configure the tunnel of a node which is, in my setup, not needed anymore anyways. For Reproduction: |
Pass in the default host and port, which might be obtained from headers or other means.
Thanks to @bbara for the suggestion on how to configure this for testing I was able to make some progress and figure out at least some of the Jenkins magic going on here. I tweaked the PR to handle those cases. I've tested it out with no tunnel set and with it set to values like "hostname:port", "hostname:", ":port", and even ":". (The latter doesn't do anything useful that I know of, but kind of exists to support the others.) I feel better after being able to reproduce at least some of the problems, at least in a simplified case. Any other reviews and testing would be welcome. I'm hopeful this is ready to go. |
Co-Authored-By: Matt Sicker <boards@gmail.com>
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.
Updated changes look good. Since last time, I did discover that Jetty has their own class fairly similar to this if you want inspiration: https://github.com/eclipse/jetty.project/blob/jetty-9.4.x/jetty-util/src/main/java/org/eclipse/jetty/util/HostPort.java
Co-Authored-By: Matt Sicker <boards@gmail.com>
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.
If you break the APi anyway, would be nice to ensure proper error propagation without runtime exceptions so that we do not hit other regressions later
host = hostValue.length() > 0 ? hostValue : defaultHost; | ||
String portString = hostPortValue.substring(portSeparator + 1).trim(); | ||
if (portString.length() > 0) { | ||
port = Integer.parseInt(portString); |
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.
Unhandled NumberFormatException
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.
NumberFormatException
was unhandled in prior versions as well. I checked it by running 3.33 (before any of these changes) with a port value that is not a number. The agent fails on startup with the NumberFormatException
.
Do you think we should change that behavior here now? Should it throw a different exception? Or log and ignore the error?
It has a use and preserves the API from the 3.34 release.
@oleg-nenashev, could you please take a look again? |
See JENKINS-59094
Under some conditions, agents using tunneling have failed to connect after changes in the 3.34 Remoting release. I haven't been able to reproduce it or isolate it yet, but this change restores the host:port parsing logic to previous behavior for handling an empty port. At a minimum, this should at least get us past the exception. It may well solve the problem.