Skip to content

[JENKINS-27555]: Re-implements JNA agent with non-blocking code#3

Merged
stephenc merged 2 commits intojenkinsci:masterfrom
ydubreuil:fix-socket-leak
Jun 2, 2015
Merged

[JENKINS-27555]: Re-implements JNA agent with non-blocking code#3
stephenc merged 2 commits intojenkinsci:masterfrom
ydubreuil:fix-socket-leak

Conversation

@ydubreuil
Copy link
Contributor

Fix JENKINS-27555.

This PR re-implements JNA agent with a non blocking socket acceptor to fix socket leak caused by blocking on accept() native call. Current implementation leaks a socket and a thread for every build.

Leaked threads have this stack:

"Thread-7" prio=10 tid=0x00007f6d30113000 nid=0x1f34 runnable [0x00007f6d54625000]
   java.lang.Thread.State: RUNNABLE
        at com.kenai.jffi.Foreign.invokeN3O2(Native Method)
        at com.kenai.jffi.Invoker.invokeN3(Invoker.java:1092)
        at jnr.unixsocket.Native$LibC$jnr$ffi$0.accept(Unknown Source)
        at jnr.unixsocket.Native.accept(Native.java:91)
        at jnr.unixsocket.UnixServerSocketChannel.accept(UnixServerSocketChannel.java:56)
        at com.cloudbees.jenkins.plugins.sshagent.jna.AgentServer$1.run(AgentServer.java:77)

Re-implements JNA agent with a non blocking socket acceptor to
fix socket leak caused by blocking on accept() native call.
@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@ydubreuil
Copy link
Contributor Author

@reviewbybees

@stephenc
Copy link
Member

stephenc commented Jun 2, 2015

👍 very good catch

@stephenc
Copy link
Member

stephenc commented Jun 2, 2015

As plugin maintainer, I am merging this now

stephenc added a commit that referenced this pull request Jun 2, 2015
[JENKINS-27555]: Re-implements JNA agent with non-blocking code
@stephenc stephenc merged commit 23afe23 into jenkinsci:master Jun 2, 2015
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.

3 participants