[JIRA] (JENKINS-58899) ThreadLocal leak causing high CPU usage with DurableTaskStep threads

0 views
Skip to first unread message

glavoie@gmail.com (JIRA)

unread,
Aug 12, 2019, 1:31:03 PM8/12/19
to jenkinsc...@googlegroups.com
Gabriel Lavoie updated an issue
 
Jenkins / Bug JENKINS-58899
ThreadLocal leak causing high CPU usage with DurableTaskStep threads
Change By: Gabriel Lavoie
Summary: ThreadLocal leak causing high CPU usage with DurableTaskStep threads
Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 12:41:02 PM8/13/19
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-58899
 
Re: ThreadLocal leak causing high CPU usage with DurableTaskStep threads

I think we should call ThreadLocal.remove here instead of trying to reset the original value, since calls to DelayBufferedOutputStream.flushBuffer will always be from a thread in the jenkins.util.Timer thread pool, and so even if we did care about what the original value was (I don't think we do, the default is true, we set it to false just for the call to flush, and then set it back to true, and it is a ThreadLocal so we don't have to worry about interference from other threads, so it will always be true going into flushBuffer IIUC), it would only matter if we happened to use a thread from the pool that we had already used previously, which is not something we can count on.

glavoie@gmail.com (JIRA)

unread,
Aug 13, 2019, 12:47:01 PM8/13/19
to jenkinsc...@googlegroups.com

As additional data to the comment above, I forgot to mention that all leaked values were boolean "true". 

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 4:56:02 PM8/13/19
to jenkinsc...@googlegroups.com
Devin Nusbaum started work on Bug JENKINS-58899
 
Change By: Devin Nusbaum
Status: Open In Progress

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 4:56:03 PM8/13/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 4:56:03 PM8/13/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 13, 2019, 4:59:03 PM8/13/19
to jenkinsc...@googlegroups.com
Devin Nusbaum commented on Bug JENKINS-58899
 
Re: ThreadLocal leak causing high CPU usage with DurableTaskStep threads

Gabriel Lavoie If you want to review https://github.com/jenkinsci/workflow-api-plugin/pull/100, and/or test it out on your instance to confirm whether it fixes the issue (Especially to see if we should modify FlushControlledOutputStream.flush in the same way based on real data), that would be appreciated, thanks!

glavoie@gmail.com (JIRA)

unread,
Aug 13, 2019, 7:42:02 PM8/13/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 27, 2019, 3:49:02 PM8/27/19
to jenkinsc...@googlegroups.com

dnusbaum@cloudbees.com (JIRA)

unread,
Aug 29, 2019, 4:08:03 PM8/29/19
to jenkinsc...@googlegroups.com
 

A fix for this issue was just released in version 2.37 of Pipeline API Plugin. Gabriel Lavoie thank you for the detailed bug report and for helping test the fix!

Change By: Devin Nusbaum
Status: Fixed but Unreleased Resolved
Released As: workflow-api 2.37
Reply all
Reply to author
Forward
0 new messages