[JENKINS-23271] - Prevent early deallocation of the Proc instance by GC in ProcStarter#join() (#2635)
[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 fd6c6aff929be9818f4eb4b84ed6b4593356853f)

protazy/jenkins,amuniz/jenkins,bpzhang/jenkins,protazy/jenkins,andresrc/jenkins,damianszczepanik/jenkins,bpzhang/jenkins,stephenc/jenkins,olivergondza/jenkins,recena/jenkins,Ykus/jenkins,Jochen-A-Fuerbacher/jenkins,recena/jenkins,alvarolobato/jenkins,damianszczepanik/jenkins,DanielWeber/jenkins,hplatou/jenkins,ydubreuil/jenkins,amuniz/jenkins,Jimilian/jenkins,jenkinsci/jenkins,daniel-beck/jenkins,sathiya-mit/jenkins,Ykus/jenkins,patbos/jenkins,ErikVerheul/jenkins,oleg-nenashev/jenkins,hplatou/jenkins,kohsuke/hudson,escoem/jenkins,hplatou/jenkins,stephenc/jenkins,MarkEWaite/jenkins,ajshastri/jenkins,viqueen/jenkins,patbos/jenkins,azweb76/jenkins,batmat/jenkins,lilyJi/jenkins,ikedam/jenkins,kohsuke/hudson,tfennelly/jenkins,olivergondza/jenkins,Jimilian/jenkins,alvarolobato/jenkins,aldaris/jenkins,bpzhang/jenkins,rlugojr/jenkins,dariver/jenkins,dariver/jenkins,andresrc/jenkins,ndeloof/jenkins,tangkun75/jenkins,ErikVerheul/jenkins,daniel-beck/jenkins,lilyJi/jenkins,escoem/jenkins,aldaris/jenkins,amuniz/jenkins,Jochen-A-Fuerbacher/jenkins,fbelzunc/jenkins,ydubreuil/jenkins,rsandell/jenkins,ikedam/jenkins,v1v/jenkins,protazy/jenkins,dariver/jenkins,aldaris/jenkins,rlugojr/jenkins,bkmeneguello/jenkins,aldaris/jenkins,sathiya-mit/jenkins,alvarolobato/jenkins,alvarolobato/jenkins,oleg-nenashev/jenkins,Jochen-A-Fuerbacher/jenkins,hplatou/jenkins,v1v/jenkins,patbos/jenkins,recena/jenkins,wuwen5/jenkins,ajshastri/jenkins,bpzhang/jenkins,ajshastri/jenkins,rsandell/jenkins,Ykus/jenkins,daniel-beck/jenkins,olivergondza/jenkins,ErikVerheul/jenkins,ajshastri/jenkins,batmat/jenkins,fbelzunc/jenkins,v1v/jenkins,recena/jenkins,ndeloof/jenkins,pjanouse/jenkins,amuniz/jenkins,tangkun75/jenkins,andresrc/jenkins,fbelzunc/jenkins,recena/jenkins,dariver/jenkins,rsandell/jenkins,Jimilian/jenkins,batmat/jenkins,jenkinsci/jenkins,escoem/jenkins,rlugojr/jenkins,stephenc/jenkins,pjanouse/jenkins,tangkun75/jenkins,godfath3r/jenkins,alvarolobato/jenkins,andresrc/jenkins,oleg-nenashev/jenkins,amuniz/jenkins,wuwen5/jenkins,sathiya-mit/jenkins,oleg-nenashev/jenkins,MarkEWaite/jenkins,ErikVerheul/jenkins,escoem/jenkins,tfennelly/jenkins,Vlatombe/jenkins,bpzhang/jenkins,DanielWeber/jenkins,Jochen-A-Fuerbacher/jenkins,tfennelly/jenkins,viqueen/jenkins,patbos/jenkins,dariver/jenkins,kohsuke/hudson,damianszczepanik/jenkins,viqueen/jenkins,rlugojr/jenkins,damianszczepanik/jenkins,DanielWeber/jenkins,godfath3r/jenkins,andresrc/jenkins,ikedam/jenkins,ajshastri/jenkins,kohsuke/hudson,ndeloof/jenkins,tfennelly/jenkins,escoem/jenkins,damianszczepanik/jenkins,viqueen/jenkins,jenkinsci/jenkins,lilyJi/jenkins,ErikVerheul/jenkins,Ykus/jenkins,rsandell/jenkins,wuwen5/jenkins,godfath3r/jenkins,Jimilian/jenkins,rlugojr/jenkins,Jimilian/jenkins,olivergondza/jenkins,batmat/jenkins,bpzhang/jenkins,ydubreuil/jenkins,kohsuke/hudson,Ykus/jenkins,patbos/jenkins,pjanouse/jenkins,tfennelly/jenkins,hplatou/jenkins,ydubreuil/jenkins,Vlatombe/jenkins,aldaris/jenkins,MarkEWaite/jenkins,ndeloof/jenkins,tangkun75/jenkins,MarkEWaite/jenkins,pjanouse/jenkins,jenkinsci/jenkins,olivergondza/jenkins,dariver/jenkins,stephenc/jenkins,dariver/jenkins,andresrc/jenkins,protazy/jenkins,patbos/jenkins,rsandell/jenkins,ndeloof/jenkins,ydubreuil/jenkins,azweb76/jenkins,fbelzunc/jenkins,azweb76/jenkins,aldaris/jenkins,daniel-beck/jenkins,fbelzunc/jenkins,fbelzunc/jenkins,pjanouse/jenkins,recena/jenkins,ajshastri/jenkins,damianszczepanik/jenkins,viqueen/jenkins,oleg-nenashev/jenkins,ikedam/jenkins,MarkEWaite/jenkins,Vlatombe/jenkins,v1v/jenkins,wuwen5/jenkins,sathiya-mit/jenkins,alvarolobato/jenkins,oleg-nenashev/jenkins,stephenc/jenkins,MarkEWaite/jenkins,rlugojr/jenkins,rsandell/jenkins,batmat/jenkins,kohsuke/hudson,azweb76/jenkins,ikedam/jenkins,pjanouse/jenkins,rlugojr/jenkins,daniel-beck/jenkins,aldaris/jenkins,protazy/jenkins,alvarolobato/jenkins,godfath3r/jenkins,lilyJi/jenkins,DanielWeber/jenkins,tangkun75/jenkins,stephenc/jenkins,v1v/jenkins,wuwen5/jenkins,Ykus/jenkins,godfath3r/jenkins,protazy/jenkins,DanielWeber/jenkins,Vlatombe/jenkins,DanielWeber/jenkins,viqueen/jenkins,v1v/jenkins,Vlatombe/jenkins,Jimilian/jenkins,escoem/jenkins,batmat/jenkins,jenkinsci/jenkins,azweb76/jenkins,hplatou/jenkins,godfath3r/jenkins,rsandell/jenkins,bkmeneguello/jenkins,v1v/jenkins,daniel-beck/jenkins,daniel-beck/jenkins,bkmeneguello/jenkins,Ykus/jenkins,stephenc/jenkins,viqueen/jenkins,MarkEWaite/jenkins,ErikVerheul/jenkins,ydubreuil/jenkins,amuniz/jenkins,Vlatombe/jenkins,amuniz/jenkins,tangkun75/jenkins,jenkinsci/jenkins,ndeloof/jenkins,wuwen5/jenkins,azweb76/jenkins,jenkinsci/jenkins,sathiya-mit/jenkins,wuwen5/jenkins,ikedam/jenkins,sathiya-mit/jenkins,fbelzunc/jenkins,protazy/jenkins,bkmeneguello/jenkins,Jochen-A-Fuerbacher/jenkins,MarkEWaite/jenkins,daniel-beck/jenkins,ajshastri/jenkins,tfennelly/jenkins,godfath3r/jenkins,tfennelly/jenkins,olivergondza/jenkins,bkmeneguello/jenkins,kohsuke/hudson,hplatou/jenkins,Jochen-A-Fuerbacher/jenkins,bpzhang/jenkins,batmat/jenkins,Jimilian/jenkins,ErikVerheul/jenkins,tangkun75/jenkins,andresrc/jenkins,lilyJi/jenkins,ikedam/jenkins,oleg-nenashev/jenkins,ikedam/jenkins,bkmeneguello/jenkins,jenkinsci/jenkins,patbos/jenkins,DanielWeber/jenkins,damianszczepanik/jenkins,Vlatombe/jenkins,pjanouse/jenkins,ndeloof/jenkins,lilyJi/jenkins,Jochen-A-Fuerbacher/jenkins,escoem/jenkins,ydubreuil/jenkins,bkmeneguello/jenkins,recena/jenkins,olivergondza/jenkins,kohsuke/hudson,azweb76/jenkins,sathiya-mit/jenkins,rsandell/jenkins,damianszczepanik/jenkins,lilyJi/jenkins