I have a Jenkins installation with moderate load and am using an SSH Agent for most of the builds that are run.
After some amount of time, builds no longer execute and this is in the logs:
java.lang.OutOfMemoryError: unable to create new native thread
Doing a thread dump, I see there are hundreds of SSH Agent threads allocated, though none seem to be doing anything.
I'm currently working around the issue by restarting the Jenkins service on a schedule. After a load test a couple of weeks ago, the Jenkins up time was dangerously close to the current interval, about 6 hours. This is already not acceptable for live deployment, but if it goes lower than about 4 hours, it will be unusable even for development.
I posted a bug report here, with pretty thorough documentation of the problem:
A kind developer doing overall triage suggested contacting this group.
Anyone have any suggestions? My employer is willing to sponsor this.
Maybe one of the SSH Agent developers knows how to fix this or what changes I might need to make on my system. I'd really like to avoid switching to a different build system, but there may not be an alternative if this issue persists.