[JIRA] (JENKINS-40742) local variable in parallel threads behaves like global variables

2018-02-23 Thread andrew.ba...@gmail.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Andrew Bayer resolved as Not A Defect  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-40742  
 
 
  local variable in parallel threads behaves like global variables   
 

  
 
 
 
 

 
Change By: 
 Andrew Bayer  
 
 
Status: 
 Open Resolved  
 
 
Resolution: 
 Not A Defect  
 

  
 
 
 
 

 
 
 

 
 
 Add Comment  
 

  
 

  
 
 
 
  
 

  
 
 
 
 

 
 This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)  
 
 

 
   
 

  
 

  
 

   





-- 
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[JIRA] (JENKINS-40742) local variable in parallel threads behaves like global variables

2017-01-01 Thread shai.kubit...@arm.com (JIRA)
Title: Message Title


 
 
 
 

 
 
 

 
   
 Shai Kubitsky created an issue  
 

  
 
 
 
 

 
 
  
 
 
 
 

 
 Jenkins /  JENKINS-40742  
 
 
  local variable in parallel threads behaves like global variables   
 

  
 
 
 
 

 
Issue Type: 
  Bug  
 
 
Assignee: 
 Unassigned  
 
 
Components: 
 pipeline  
 
 
Created: 
 2017/Jan/01 1:27 PM  
 
 
Priority: 
  Minor  
 
 
Reporter: 
 Shai Kubitsky  
 

  
 
 
 
 

 
 running this pipeline: def do_i(p) { return { echo "$p" for (i = 0; i < 10; i++)  { echo "i: $i" }  } } stage('i') { parallel( "x" : do_i('xx'), "y" : do_i('yy') ) } produces this output: [Pipeline] stage [Pipeline] {  [Pipeline] parallel [Pipeline] [x] { (Branch: x) [Pipeline] [y]  { (Branch: y) [Pipeline] [x] echo [x] xx [Pipeline] [y] echo [y] yy [Pipeline] [x] echo [x] i: 0 [Pipeline] [y] echo [y] i: 1 [Pipeline] [x] echo [x] i: 2 [Pipeline] [y] echo [y] i: 3 [Pipeline] [x] echo [x] i: 4 [Pipeline] [y] echo [y] i: 5 [Pipeline] [x] echo [x] i: 6 [Pipeline] [y] echo [y] i: 7 [Pipeline] [x] echo [x] i: 8 [Pipeline] [y] echo [y] i: 9 [Pipeline] [y] } [Pipeline] [x] echo [x] i: 10 [Pipeline] [x] } [Pipeline] // parallel [Pipeline] } [Pipeline] // stage [Pipeline] End of Pipeline Note how i is incremented as if both threads were referring to the same variable i. If I modify the for loop to: for (int i = 0; i < 10; i++) then it works as I expect, where each thread has its own i variable: [Pipeline] stage [Pipeline] {  [Pipeline] parallel [Pipeline] [x] { (Branch: x) [Pipeline] [y]  { (Branch: y) [Pipeline] [x] echo [x] xx [Pipeline] [y] echo [y] yy [Pipeline] [x] echo [x] i: 0 [Pipeline] [y] echo [y] i: 0 [Pipeline] [x] echo [x] i: 1 [Pipeline] [y] echo [y] i: 1 [Pipeline] [x] echo [x] i: 2 [Pipeline] [y] echo [y] i: 2 [Pipeline] [x] echo [x] i: 3 [Pipeline] [y] echo [y] i: 3 [Pipeline] [x] echo [x] i: 4 [Pipeline] [y] echo [y] i: 4 [Pipeline] [x] echo [x] i: 5 [Pipeline] [y] echo [y] i: 5 [Pipeline] [x] echo [x] i: 6 [Pipeline] [y] echo [y] i: 6 [Pipeline] [x] echo [x] i: 7 [Pipeline] [y] echo [y] i: 7 [Pipeline] [x] echo [x] i: 8 [Pipeline] [y] echo [y] i: 8 [Pipeline] [x] echo [x] i: 9 [Pipeline] [x] }