提交 5627760e 编写于 作者: K kohsuke

fixed NPE I saw in my production system. Root cause is unknown, but the...

fixed NPE I saw in my production system. Root cause is unknown, but the javadoc says getNode can return null indeed, so making the code bit more defensive

java.lang.NullPointerException
	at hudson.model.Queue$JobOffer.canTake(Queue.java:178)
	at hudson.model.Queue$ApplicableJobOfferList.(Queue.java:765)
	at hudson.model.Queue$ApplicableJobOfferList.(Queue.java:757)
	at hudson.model.Queue.pop(Queue.java:682)
	at hudson.model.Executor.grabJob(Executor.java:160)
	at hudson.model.Executor.run(Executor.java:102)



git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@24776 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8dab2709
......@@ -171,11 +171,14 @@ public class Queue extends ResourceController implements Saveable {
* Verifies that the {@link Executor} represented by this object is capable of executing the given task.
*/
public boolean canTake(Task task) {
Node node = getNode();
if (node==null) return false; // this executor is about to die
Label l = task.getAssignedLabel();
if(l!=null && !l.contains(getNode()))
if(l!=null && !l.contains(node))
return false; // the task needs to be executed on label that this node doesn't have.
if(l==null && getNode().getMode()== Mode.EXCLUSIVE)
if(l==null && node.getMode()== Mode.EXCLUSIVE)
return false; // this node is reserved for tasks that are tied to it
return isAvailable();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册