Reserved. 7 • Distributed builds – success factor of Hudson/Jenkins • Remoting – engine under the hood of Jenkins • Agents (FKA “slaves”) are powered by Remoting • In-house implementation What is Remoting?
Reserved. 8 üHOW DO AGENTS WORK? üWHAT TO DO IF THEY DO NOT? Agenda Disclaimer: • The presentation represents the speaker’s personal opinion • My opinion may differ from official position of CloudBees or Jenkins Community • Jenkins “agent” and “slave” terms are equivalent
Reserved. 12 Remoting. What does it do? Agent executable (slave.jar) Master communication protocols Classloading Remote I/O Streams Monitoring of agents
Reserved. 13 Oleg &vs. Remoting • Dealing with Remoting since 2008 • Maintained own fork at Synopsys • Became Remoting maintainer at CloudBees • Maintain Remoting during working hours • Deal with support escalations
Reserved. 21 Why JNLP4? • Poor diagnosability when issue happens All • Known issues in connection management • RejectedExecutionEx in ExecutorService kills ALL connections (.../remoting/pull/156 ) JNLP1/JNLP2 • Does not “just work”… • Errata: .../remoting/blob/master/docs/protocols.md - jnlp3-connect-errata JNLP3 • No big ones so far… • Jenkins 2.27+ JNLP4
Reserved. 30 Dealing with Remoting issues Check your setup • Jenkins versions, Remoting versions, Java versions Check Release notes Ask for Help Submit issue to the bugtracker
Reserved. 32 Remoting Versions • Update to the version on master SSH agents • No auto-update till Jenkins 2.50 Windows Service agents • No auto-update JNLP agents • No bugfixes • No new protocols (e.g. JNLP4) • Worse diagnosability • Potential compatibility issues OOTB:
Reserved. 33 How to check the Remoting version? • System Information on the agent page • Version Column Plugin: https://plugins.jenkins.io/versioncolumn
Reserved. 34 Java versions • Jenkins needs some native libs • IBM Java has known compat issues Vendor • Do NOT use 32-bit Java on 64bit Windows • https://github.com/kohsuke/winp#platform-support • 32-bit Java is bundled in Jenkins Windows Installers L Target platform • Jenkins’ Java requirements apply to agents as well • Otherwise – Undefined behavior Version
Reserved. 36 Configuring Java monitors ${JENKINS_URL}/computer/configure Built-in strategies: • Agent JVM version is greater or equal than the Master’s supported one (default) • Agent JVM major.minor version is equal to the Master one (paranoid) • Agent JVM whose is exactly equal to the Master one (paranoid++)
Reserved. 40 Dealing with Remoting issues Check your setup • Remoting versions, Java versions Check Release notes • Search by stacktraces works well Ask for Help • jenkinsci-users, IRC, StackOverflow, etc. Submit issue to the bugtracker • And work with reviewers
Reserved. 43 Dealing with Remoting issues Check your setup • Remoting versions, Java versions Check Release notes • Search by stacktraces works well Ask for Help • jenkinsci-users, IRC, StackOverflow, etc. Submit issue to the bugtracker • And work with reviewers
Reserved. 50 Problem: No logging by default • No logging SSH agents • Logging with logrotate • Collected by Support Core when agent is online Windows Service agents • No logging JNLP agents OOTB:
Reserved. 51 Enabling logging in SSH/JNLP agents • Tee STDOUT/STDERR to a file • No Logrotate Support GOOD – “-slaveLog” parameter • Shell-dependent • SSH agents – patch command suffix BAD – STDOUT/STDERR redirect • NOT Documented as well • Some logs go to STDOUT/STDERR NOT UGLY – JUL property file
Reserved. 53 What to do NOW? • 2.46+ for Remoting patches • For Windows – LTS 2.60.1+ Keep Jenkins up to date • JNLP agents need to be configured • Logging by default – coming soon Setup agent logging • Adjust network settings • Optimize Remoting throughput Work on infrastructure
Reserved. 60 Ongoing changes • Windows services • Work directories in Remoting (JENKINS-44108) • Logging on agents by default (JENKINS-39369) • Documentation •https://github.com/jenkinsci/remoting/
Reserved. 61 Windows - New Service Wrapper • Jenkins 2.50+ • For new agents… •Remoting auto-update on agent side •Runaway Process Killer • Update is required •http://bit.ly/jenkins-winsw2-upgrade https://github.com/kohsuke/winsw/
Reserved. 66 Takeaways Jenkins 2 is not just about Pipelines • Keep updating! Remoting – risk factor in Jenkins • INFRA issues - frequent root cause • You need to design large-scale instances • Remoting can be stabilized Asking for help is fine Contributing is not just about code • Share your experience
Reserved. 69 Examples (I have slides!): • My agent hangs and does nothing • I run agents on Windows. Any extra features there? • I see “channel is already closed” in logs. What to do? Contacts: E-mail: [email protected] GitHub: oleg-nenashev Twitter: @oleg_nenashev