[CentOS-devel] Jenkins causing memory leaks in all major web browsers

Wed Aug 31 21:51:46 UTC 2016
Laurentiu Pancescu <lpancescu at gmail.com>

In the first days spent developing the CI tests for our Vagrant images, 
I used the Jenkins web interface a lot, without ever closing the tab or 
the browser.  At the end of the second day, my Mac mini became very slow 
- I found it using 970MB of swap, and the Firefox process' memory had 
grown from the typical 700-900MB to 2.95GB.  Firefox' about:memory 
reported that ci.centos.org took 1.6GB, out of which 1.2GB in 'orphan 
DOM nodes'.

Someone from #memshrink on irc.mozilla.org told me that a fix for 
something related to Jenkins had been committed in the past week, and I 
should try to reproduce it with Firefox Nightly.  I used a clean 
profile, only loaded ci.centos.org and left it alone, without doing 
anything.  Over 7 hours, the memory usage of the web content process 
increased from 122MB to 1.78GB.  I also tried this evening with Firefox 
48.0.2 from Fedora 24, with a fresh profile: the memory usage increased 
from 192MB to 613MB in 60 minutes (305MB being 'orphan DOM nodes', 
according to about:memory).  I was also able to reproduce this behavior 
with Safari and Chrome on OS X: Safari went from 67MB to 1GB, while 
Chrome went from 120MB to 1.7GB, both in less than 3 hours.

This looks like a bug in the Jenkins web interface.  Unfortunately, I 
had already filed a bug with Mozilla [1] before finding a bug report 
from January 2014 in the Jenkins tracker, describing a memory leak in 
Chrome, Firefox and Internet Explorer (all running on Windows). [2]

Is there anyone with a good understanding of closures and cyclic 
references between Javascript objects and the DOM, willing to take a 
look at what's going on?  The Developer Tools in both Firefox and Chrome 
are able to take heap snapshots and compare them, and also record all 
memory allocations; this would probably make debugging easier than it 
was the case in January 2014.

Regards,
Laurențiu


[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1298981
[2] https://issues.jenkins-ci.org/browse/JENKINS-10912