Skip to content
Commit fcfd271a authored by Oleg Nenashev's avatar Oleg Nenashev Committed by Oliver Gondža
Browse files

[JENKINS-23271] - Prevent early deallocation of the Proc instance by GC in...

[JENKINS-23271] - Prevent early deallocation of the Proc instance by GC in ProcStarter#join() (#2635)

* [JENKINS-23271] - Prevent the prelimimary deallocation of the Proc instance by GC

It is a hackish way, which likely prevents a preliminary deallocation of the spawned RemoteProc instance, which we see in JENKINS-23271. Proc instance was not actually required in the original code since we were creating and using RemoteInvocationHandler wrapper only, and the theory discussed with @stephenc was that object gets removed by Java8 garbage collector before we get into join().

This fix enforces the persistency of ProcStarter#start() result by adding logging and the enforced volatile field (maybe the last one is not really required, but JIT compiler in Java implementations may be smart enough to skip unused loggers)

This is a pretty old fix from August, which has been soak tested on my instance for several weeks (mid-August => Jenkins World). On the reference instance (just a small Jenkins instance with 4 agents and very frequent builds with CommandInterpreter steps) I saw 2 failures over the period. On the fixed instance - 0. It does not proof anything, but at least the fix was soak tested a bit

* [JENKINS-23271] - Get rid of the procHolderForJoin field

* [JENKINS-23271] - Also put the check into the finally statement as @stephenc proposed

* Remove assert

(cherry picked from commit fd6c6aff)
parent dacbe03e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment