Skip to content

Commit

Permalink
[FIXED JENKINS-15578]
Browse files Browse the repository at this point in the history
The slave launch thread is another background thread, and it should run
like a super-user
  • Loading branch information
kohsuke committed Jun 15, 2013
1 parent af7cd9b commit 4a71b01
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -55,6 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=bug>
Slave launch thread should have the background activitiy credential.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-15578">issue 15578</a>)
<li class=bug>
“Build Now” link did not work for multijobs.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-16974">issue 16974</a>)
Expand Down
4 changes: 4 additions & 0 deletions core/src/main/java/hudson/slaves/SlaveComputer.java
Expand Up @@ -72,6 +72,7 @@
import javax.servlet.RequestDispatcher;
import jenkins.model.Jenkins;
import jenkins.slaves.JnlpSlaveAgentProtocol;
import org.acegisecurity.Authentication;

This comment has been minimized.

Copy link
@jglick

jglick Jun 18, 2013

Member

Why the unused import?

import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.QueryParameter;
Expand Down Expand Up @@ -217,6 +218,9 @@ protected Future<?> _connect(boolean forceReconnect) {
public Object call() throws Exception {
// do this on another thread so that the lengthy launch operation
// (which is typical) won't block UI thread.

ACL.impersonate(ACL.SYSTEM); // background activity should run like a super user

This comment has been minimized.

Copy link
@jglick

jglick Jun 18, 2013

Member

Needs to reset in a finally block; this is a shared thread pool! (Even if the code currently ran to the end of a Thread, safer to use the reset idiom in case someone refactors it to use Executor.)


try {
log.rewind();
try {
Expand Down

0 comments on commit 4a71b01

Please sign in to comment.