Skip to content
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-41730] - Add option to ignore the X-Jenkins-Agent-Protocols header #146

Merged
merged 4 commits into from
Feb 13, 2017

Conversation

oleg-nenashev
Copy link
Member

In particular cases the X-Jenkins-Agent-Protocols response header may change (e.g. due to the improperly configured proxy). This change adds diagnostics for such case and also adds a system property, which allows working around the issue by sacrificing the performance.

  • Add the org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.ignoreJenkinsAgentProtocolsHeader property, which disables the cache
  • Print warning in the case if the list of supported protocols is empty
  • Add documentation

https://issues.jenkins-ci.org/browse/JENKINS-41730

@reviewbybees, esp. @stephenc

…header + improve diagnostics

- [x] Add the `org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.ignoreJenkinsAgentProtocolsHeader` property, which disables the cache
- [x] Print warning in the case if the list of supported protocols is empty
- [x] Add documentation
@stephenc
Copy link
Member

stephenc commented Feb 5, 2017

🐛 if the server says do not try JNLP2 then do not try JNLP2 as there could be a MiM. Better to have the system property take the list of protocols rather than being a boolean

That way for systems needing the assurance of JNLP4 they can keep that assurance

@oleg-nenashev
Copy link
Member Author

@stephenc OK, will update. Though I feel it causes some fun with order of the protocols. It should be listed at least

@stephenc
Copy link
Member

stephenc commented Feb 6, 2017

causes some fun with order of the protocols

Just say it is the set of protocols to try. the order of protocol attempts is hard-coded

…dpointResolver.protocolNamesToTry according to the feedback from @stephenc

if (agentProtocolNames.isEmpty()) {
LOGGER.log(Level.WARNING, "Received the empty list of supported protocols from the server. " +
"All protocols are disabled on the master side OR the 'X-Jenkins-Agent-Protocols' header is corrupted (JENKINS-41730). " +
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the problem is that the header is set, but empty? Who the hell does that!?

Shouldn't this also apply to the case that the header isn't set, or do we handle that better anyway?

Copy link
Member

@daniel-beck daniel-beck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous comment still applies, but for a mostly diagnostic system property, should be fine.

"to define the supported protocols.");
}

LOGGER.log(Level.INFO, "Remoting server accepts the following protocols: {0}", agentProtocolNames);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be in an else block?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I agree

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were you going to address this?

@oleg-nenashev
Copy link
Member Author

oleg-nenashev commented Feb 7, 2017 via email

@daniel-beck
Copy link
Member

Regarding the header replacement, this is a HTTPS wrapper

Right, just wondered where we draw the line between what's reasonable to support, and what's just too crazy…

@oleg-nenashev
Copy link
Member Author

@stephenc ping, wdyt?

Copy link
Member

@stephenc stephenc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but looks like you still have changes that DB requested

@oleg-nenashev
Copy link
Member Author

Yes, but there was no sense to fix it before the major blocker got solved

@oleg-nenashev
Copy link
Member Author

May be a candidate for backporting

@oleg-nenashev
Copy link
Member Author

I doubt we really want to backport it.

@oleg-nenashev
Copy link
Member Author

@reviewbybees done

@oleg-nenashev oleg-nenashev merged commit 612cc27 into jenkinsci:master Feb 13, 2017
oleg-nenashev added a commit that referenced this pull request Feb 16, 2017
oleg-nenashev added a commit to oleg-nenashev/jenkins that referenced this pull request Feb 17, 2017
https://github.com/jenkinsci/remoting/edit/master/CHANGELOG.md

Fixed issues:

* [JENKINS-40710](https://issues.jenkins-ci.org/browse/JENKINS-40710) - Match headers case-insensitively in `JnlpAgentEndpointResolver` in order to be compliant with HTTP2 lower-case headers. ([PR jenkinsci#139](jenkinsci/remoting#139), [PR jenkinsci#140](jenkinsci/remoting#140))
* [JENKINS-41513](https://issues.jenkins-ci.org/browse/JENKINS-41513) - Prevent `NullPointerException` in `JnlpAgentEndpointResolver` when receiving a header with `null` name. ([PR jenkinsci#140](jenkinsci/remoting#140))
* [JENKINS-41852](https://issues.jenkins-ci.org/browse/JENKINS-41852) - Fix exported object pinning logic to prevent release due to the integer overflow. ([PR jenkinsci#148](jenkinsci/remoting#148))

Improvements:

* [JENKINS-41730](https://issues.jenkins-ci.org/browse/JENKINS-41730) - Add the new `org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.ignoreJenkinsAgentProtocolsHeader` property, which allows specifying a custom list of supported protocols instead of the one returned by the Jenkins master. ([PR jenkinsci#146](jenkinsci/remoting#146))
* Print the Filesystem Jar Cache directory location in the error message when this cache directory is not writable. ([PR jenkinsci#143](jenkinsci/remoting#143))
* Replace `MimicException` with the older `ProxyException` when serializing non-serializable exceptions thrown by the remote code. ([PR jenkinsci#141](jenkinsci/remoting#141))
* Use OID of the `ClassLoaderProxy` in error message when the proxy cannot be located in the export table. ([PR jenkinsci#147](jenkinsci/remoting#147))
olivergondza pushed a commit to jenkinsci/jenkins that referenced this pull request Mar 13, 2017
https://github.com/jenkinsci/remoting/edit/master/CHANGELOG.md

Fixed issues:

* [JENKINS-40710](https://issues.jenkins-ci.org/browse/JENKINS-40710) - Match headers case-insensitively in `JnlpAgentEndpointResolver` in order to be compliant with HTTP2 lower-case headers. ([PR #139](jenkinsci/remoting#139), [PR #140](jenkinsci/remoting#140))
* [JENKINS-41513](https://issues.jenkins-ci.org/browse/JENKINS-41513) - Prevent `NullPointerException` in `JnlpAgentEndpointResolver` when receiving a header with `null` name. ([PR #140](jenkinsci/remoting#140))
* [JENKINS-41852](https://issues.jenkins-ci.org/browse/JENKINS-41852) - Fix exported object pinning logic to prevent release due to the integer overflow. ([PR #148](jenkinsci/remoting#148))

Improvements:

* [JENKINS-41730](https://issues.jenkins-ci.org/browse/JENKINS-41730) - Add the new `org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.ignoreJenkinsAgentProtocolsHeader` property, which allows specifying a custom list of supported protocols instead of the one returned by the Jenkins master. ([PR #146](jenkinsci/remoting#146))
* Print the Filesystem Jar Cache directory location in the error message when this cache directory is not writable. ([PR #143](jenkinsci/remoting#143))
* Replace `MimicException` with the older `ProxyException` when serializing non-serializable exceptions thrown by the remote code. ([PR #141](jenkinsci/remoting#141))
* Use OID of the `ClassLoaderProxy` in error message when the proxy cannot be located in the export table. ([PR #147](jenkinsci/remoting#147))

(cherry picked from commit 815da8a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants