Branch: refs/heads/master
  Home:   https://github.com/jenkinsci/remoting
  Commit: 7f39bdb1c639b64fc4da5a8efaeafa41d4b259cf
      
https://github.com/jenkinsci/remoting/commit/7f39bdb1c639b64fc4da5a8efaeafa41d4b259cf
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java

  Log Message:
  -----------
  Avoid leaking a hard reference to Channel into a ThreadLocal


  Commit: b6f1d079251b8d3f98002c40fd6f938a4af783a2
      
https://github.com/jenkinsci/remoting/commit/b6f1d079251b8d3f98002c40fd6f938a4af783a2
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java

  Log Message:
  -----------
  Fix Javadoc links


  Commit: fa8cd957b6ab3484d60ff8915de3d94f3beb6b16
      
https://github.com/jenkinsci/remoting/commit/fa8cd957b6ab3484d60ff8915de3d94f3beb6b16
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java

  Log Message:
  -----------
  When clearing the current thread's Channel, remove the ThreadLocal


  Commit: d97ae659761fe4e0786f0ef9c2d3fb1439aade69
      
https://github.com/jenkinsci/remoting/commit/d97ae659761fe4e0786f0ef9c2d3fb1439aade69
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/JarCacheSupport.java
    A src/main/java/hudson/remoting/NamingThreadFactory.java

  Log Message:
  -----------
  add a thread factory that names the threads


  Commit: 663bd66340f685e2bc2e2f27b72d8bb58bdb183c
      
https://github.com/jenkinsci/remoting/commit/663bd66340f685e2bc2e2f27b72d8bb58bdb183c
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M pom.xml

  Log Message:
  -----------
  Upgrade findbugs to version compatible with java 8


  Commit: afd40027c9421570ec6ccdb80bdfe9e95d8f4a4b
      
https://github.com/jenkinsci/remoting/commit/afd40027c9421570ec6ccdb80bdfe9e95d8f4a4b
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Launcher.java

  Log Message:
  -----------
  findbugs wants this changed


  Commit: c4616b642e045b4b6f2809478a818d058dc081ce
      
https://github.com/jenkinsci/remoting/commit/c4616b642e045b4b6f2809478a818d058dc081ce
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/test/java/hudson/remoting/ChannelTest.java
    M src/test/java/hudson/remoting/util/GCTask.java

  Log Message:
  -----------
  We need to force GC more agressively for testExportCalleeDeallocation


  Commit: 7e858e3651f1e535d289eebaa92084c31a4b610b
      
https://github.com/jenkinsci/remoting/commit/7e858e3651f1e535d289eebaa92084c31a4b610b
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-10 (Wed, 10 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java
    M src/main/java/hudson/remoting/RemoteClassLoader.java
    M src/main/java/hudson/remoting/RemoteInvocationHandler.java

  Log Message:
  -----------
  Simplify work for the VM garbage collector

- In larger installations of Jenkins the complex cycles of object references 
containing classloaders containing references to the channel which contains 
references back to the classloaders can confuse the garbage collector.
- The confusion arrises because classloaders are considered live while there 
are objects from the classloader live
  and the RemoteClassLoader and RemoteInvocationHandler's proxy both need a 
reference to the Channel
  which typically can be storing either some of the objects from the 
RemoteClassLoader or
  the RemoteInvocationHandler's proxy instances in the Channel properties. Thus 
although the entire subgraph
  is no longer live, the cycle is not detected as ClassLoaders are treated 
separately. The issue is worse in
  Java 7 where the ClassLoaders are on the PermGen heap though it is also 
present in Java 8.
- Typically multiple out of memory errors can cause the cycle to ultimately get 
cleaned up as one half
  gets cleared out breaking the cycle enough so that a subsequent out of memory 
removes the second half leaving
  a third out of memory to clear out the ClassLoaders... but after three out of 
memory errors in a row, Jenkins
  itself is typically well dead.

This commit (I believe) fixes these issues:
- We apply [Wheeler's 
theorem](http://en.wikipedia.org/wiki/Fundamental_theorem_of_software_engineering)
 to
  the Channel references. This allows us to clear out the reference instance as 
soon as the Channel is terminated
  thus simplifying the work of the garbage collector.
- We move from using an Object.finalize() implementation to a PhantomReference 
implementation of the
  unexporting operation. In my experiments the call to Object.finalize() on a 
running Jenkins instance would
  very often get postponed to almost never, and more critically, the presence 
of a finalizer means that all
  instances of RemoteInvocationHandler were put in the finalizer queue as 
opposed to only those that
  need to be tracked for auto unexporting. We can (and do) proactively remove 
the references from the
  reference queue as soon as the channel is closed, further reducing the work 
that is required by the
  garbage collector.


  Commit: a402ce749e8e4db0f773ee54d9c6ac3df43d4e9b
      
https://github.com/jenkinsci/remoting/commit/a402ce749e8e4db0f773ee54d9c6ac3df43d4e9b
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java

  Log Message:
  -----------
  Add javadoc to explain why we want to avoid anon inner class


  Commit: e9b0ffd68f92757448a952de9001abd984050f7c
      
https://github.com/jenkinsci/remoting/commit/e9b0ffd68f92757448a952de9001abd984050f7c
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/Channel.java

  Log Message:
  -----------
  add javadoc explaining why we want our own reference implementation rather 
than a standard one


  Commit: ad1bb06e6b9b2fe9b630bf8fb4403d9dd81bd558
      
https://github.com/jenkinsci/remoting/commit/ad1bb06e6b9b2fe9b630bf8fb4403d9dd81bd558
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/RemoteInvocationHandler.java

  Log Message:
  -----------
  throw an IOException on closed channel rather than an NPE


  Commit: b6714b70de0c21bd41fb7cb9eede1a848c161043
      
https://github.com/jenkinsci/remoting/commit/b6714b70de0c21bd41fb7cb9eede1a848c161043
  Author: Stephen Connolly <[email protected]>
  Date:   2015-06-15 (Mon, 15 Jun 2015)

  Changed paths:
    M src/main/java/hudson/remoting/RemoteInvocationHandler.java

  Log Message:
  -----------
  when references are being released quickly, process the references with 
priority over clearing out dead channels

The dead channels should be much rarer as they should almost clear themselves


  Commit: bf81838a2c6ab8fcc96f54fedff003c168433688
      
https://github.com/jenkinsci/remoting/commit/bf81838a2c6ab8fcc96f54fedff003c168433688
  Author: Kohsuke Kawaguchi <[email protected]>
  Date:   2015-07-13 (Mon, 13 Jul 2015)

  Changed paths:
    M pom.xml
    M src/main/java/hudson/remoting/Channel.java
    M src/main/java/hudson/remoting/JarCacheSupport.java
    M src/main/java/hudson/remoting/Launcher.java
    A src/main/java/hudson/remoting/NamingThreadFactory.java
    M src/main/java/hudson/remoting/RemoteClassLoader.java
    M src/main/java/hudson/remoting/RemoteInvocationHandler.java
    M src/test/java/hudson/remoting/ChannelTest.java
    M src/test/java/hudson/remoting/util/GCTask.java

  Log Message:
  -----------
  Merge pull request #54 from jenkinsci/fix-memory-leak

[JENKINS-28844] Fix memory leak


Compare: 
https://github.com/jenkinsci/remoting/compare/05329f599148...bf81838a2c6a

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to