timja / jenkins-gh-issues-poc-06-18

0 stars 0 forks source link

[JENKINS-28086] JNLP slave connection does not consider java non-proxy settings (http.nonProxyHosts) #7159

Open timja opened 9 years ago

timja commented 9 years ago

Our JNLP connection shall work directly and not via Proxy.

Because our Linux environment per default sets "http_proxy" environment variable and java detects this per default before the java net.properties (jre/lib/net.properties), we started the JNLP Connection with JAVA_OPTS:

"-Dhttp.proxyHost=... -Dhttp.proxyPort=... -Dhttp.nonProxyHosts=..."

Until slave version 2.49 this worked fine. Beginning with Version 2.50 we got an error:

Apr 24, 2015 3:11:04 PM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: xxxx
Apr 24, 2015 3:11:04 PM hudson.remoting.jnlp.Main$CuiListener
INFO: Jenkins agent is running in headless mode.
Apr 24, 2015 3:11:04 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among http://xxx/ci/
Apr 24, 2015 3:11:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Apr 24, 2015 3:11:05 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to xxx:25000
Apr 24, 2015 3:11:15 PM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to xxx:25000 (retrying:2)
java.io.IOException: Got a bad response from proxy: HTTP/1.0 403 Forbidden
at hudson.remoting.Engine.connect(Engine.java:357)
at hudson.remoting.Engine.run(Engine.java:241)

Seems the http.nonProxyHosts is not considered and boolean "isProxy" is the to true:
(see Line 357, src/main/java/hudson/remoting/Engine.java, https://github.com/jenkinsci/remoting/commit/08b910c7df9a1356b6c53f885c63ea6523e22943)

We could unset the environment http_proxy variable and start the agent without additional JAVA_OPTS, but in this case the needed environment variable is not exported to the agent shell build tasks.

Main-Class: hudson.remoting.Launcher
Version: 2.50


Originally reported by h_hermanns, imported from: JNLP slave connection does not consider java non-proxy settings (http.nonProxyHosts)
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2022/01/10
timja commented 9 years ago

danielbeck:

in this case the needed environment variable is not exported to the agent shell build tasks

Isn't this trivial to set up in the node configuration?

timja commented 9 years ago

h_hermanns:

Yes, that is be a possible workaround together with unsetting the parameters before launching the JNLP session.

From my point of view it would be better or more correct to consider non-proxy setting in slave.jar.

timja commented 8 years ago

aheritier:

remoting 2.54 including the required fix was released 3 days ago
This one duplicates JENKINS-28289 ?

timja commented 8 years ago

zss:

This is a huge pain when having a corporate proxy. This is still a bug in jenkins 2.0 rc.
So I was actually trying out Jenkins running on the LAN, where the proxy shouldn't be used, but the http_proxy is set by some corporate scripts, and reset every few minutes.
I tried using cntlm which was configured to skip the corporate proxy on LAN. The only workaround was to put the whole jnpl launch in a batch file and set the http_proxy to the cntlm one forcefully before launching the slave/agent, this way the shell scrips would also use a working proxy.

So not hard, but not really trivial. Fixing the bug in Jenkins should be easier, right?

timja commented 2 years ago

[Originally related to: JENKINS-39942]

timja commented 2 years ago

[Originally related to: JENKINS-39942]