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-51818] Add JNLP port availability check #275

Merged
merged 2 commits into from
Jun 21, 2018

Conversation

denami
Copy link

@denami denami commented Jun 8, 2018

In same configuration of balancer or firewall Jenkins HTTP/HTTPS port available for slave, but JNLP port is not visible for slave.

if (e instanceof SocketTimeoutException) {
reason = "timeout while attempting to reach node " + hostname + " on port " + port;
}
} finally {
Copy link
Member

Choose a reason for hiding this comment

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

maybe it makes sense to suppress other exceptions (runtime&Co)

Copy link
Author

Choose a reason for hiding this comment

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

Yes. It make sense.

@oleg-nenashev
Copy link
Member

@denami Would it be possible to create a JIRA ticket for this defect?

@denami denami changed the title Add JNLP port availability check JENKINS-51818 Add JNLP port availability check Jun 8, 2018
@denami denami changed the title JENKINS-51818 Add JNLP port availability check [JENKINS-51818] Add JNLP port availability check Jun 8, 2018
@denami
Copy link
Author

denami commented Jun 8, 2018

Yes. JIRA ticket created.

Copy link
Member

@KostyaSha KostyaSha left a comment

Choose a reason for hiding this comment

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

If i correctly remember the worst case when connection is dropped and waits infinitely on first host behind balancer that ends with infinite timeout and unability to connect slave. Workaround was to TCP reject port incoming packets on firewal.

s = new Socket();
s.setReuseAddress(true);
SocketAddress sa = new InetSocketAddress(hostname, port);
s.connect(sa, timeout);
Copy link
Member

Choose a reason for hiding this comment

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

probably `setSoTimeout()' for safety should be also defined

Copy link
Author

Choose a reason for hiding this comment

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

connect() method also has simple check for timeout value.

Copy link
Member

Choose a reason for hiding this comment

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

connect timeout != readtimeout , there is no read here, but just in case something will try to read from stream it may stuck operation

Copy link
Author

Choose a reason for hiding this comment

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

In this case we read nothing from socket. I think it is not necessary.

@denami
Copy link
Author

denami commented Jun 21, 2018

@oleg-nenashev Is any restriction for merge this pull request?

Copy link
Member

@oleg-nenashev oleg-nenashev left a comment

Choose a reason for hiding this comment

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

LGTM. @dwnusbaum @jeffret-b any concerns?

@oleg-nenashev oleg-nenashev merged commit 02bb70b into jenkinsci:master Jun 21, 2018
@oleg-nenashev
Copy link
Member

Release ETA: tomorrow

saptarshide007 pushed a commit to saptarshide007/remoting that referenced this pull request Mar 22, 2021
After updating from java 8 to java 11 getting the below error:-
Exception in thread "main" java.lang.IllegalArgumentException: object is not an instance of declaring class
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at hudson.remoting.Launcher.addClasspath(Launcher.java:129)

On analysing the remoting source code found that the hudson.remoting.Launcher.addClasspath invokes URLClassLoader and passes the instance using ClassLoader.getSystemClassLoader().
However in java 11, this seems like an illegal operation as ClassLoader.getSystemClassLoader() does not get the instance of  URLClassLoader due to which we are getting the error "object is not an instance of declaring class".

To fix this issue what updated the addClasspath method to invoke the URLClassLoader using a new instance of the class.

Reference:-
GitIssues:-jenkinsci#274,jenkinsci#275
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.

5 participants