Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-58878] Add test that reproduces the issue #49

Merged
merged 4 commits into from
Nov 19, 2019

Conversation

dwnusbaum
Copy link
Member

@dwnusbaum dwnusbaum commented Nov 6, 2019

See JENKINS-58878.

Update: fix is in jenkinsci/workflow-cps-plugin#335, I'll update this PR once I have an incremental build.


Just adding an ignored test for now while I try to figure out the right way to fix the problem. Here's a bad fix:

--- a/src/main/java/org/jenkinsci/plugins/workflow/steps/GeneralNonBlockingStepExecution.java
+++ b/src/main/java/org/jenkinsci/plugins/workflow/steps/GeneralNonBlockingStepExecution.java
@@ -74,6 +74,7 @@ public abstract class GeneralNonBlockingStepExecution extends StepExecution {
             threadName = Thread.currentThread().getName();
             try {
                 try (ACLContext acl = ACL.as(auth)) {
+                    Thread.sleep(10L);
                     block.run();
                 }
             } catch (Throwable x) {

From playing with that fix, the sleep only seems to matter for starting the step. If you disable the sleep when run is called from TailCall.onSuccess, the test still passes. The test usually blocks for me pretty quickly (within 5 iterations of the loop), but I have seen it run as many as 40 iterations successfully.

One strange thing to me is that based on the log output, the completion callbacks appear to be running before the body executes. Here is the output of one of the hung tests:

   6.733 [test0 #1] Started
   7.930 [test0 #1] [Pipeline] slowBlock
   7.984 [test0 #1] starting step
   7.984 [test0 #1] starting background part of step
   7.984 [test0 #1] starting body
   7.985 [test0 #1] [Pipeline] {
   8.145 [test0 #1] body completed, starting background end part of step
   8.145 [test0 #1] ending step
   8.146 [test0 #1] [Pipeline] echo
   8.146 [test0 #1] At 0
   8.147 [test0 #1] [Pipeline] }
   8.199 [test0 #1] [Pipeline] // slowBlock
   8.254 [test0 #1] [Pipeline] slowBlock
   8.254 [test0 #1] starting step
   8.254 [test0 #1] starting background part of step
   8.254 [test0 #1] starting body
   8.255 [test0 #1] [Pipeline] {
   8.309 [test0 #1] body completed, starting background end part of step
   8.309 [test0 #1] ending step
   8.310 [test0 #1] [Pipeline] echo
   8.310 [test0 #1] At 1
   8.310 [test0 #1] [Pipeline] }
   8.311 [test0 #1] [Pipeline] // slowBlock
   8.311 [test0 #1] [Pipeline] slowBlock
   8.311 [test0 #1] starting step
   8.312 [test0 #1] starting background part of step
   8.312 [test0 #1] starting body
   8.364 [test0 #1] [Pipeline] {
   8.364 [test0 #1] body completed, starting background end part of step
   8.364 [test0 #1] ending step
   8.365 [test0 #1] [Pipeline] echo
   8.365 [test0 #1] At 2
   8.365 [test0 #1] [Pipeline] }
   8.417 [test0 #1] [Pipeline] // slowBlock
   8.418 [test0 #1] [Pipeline] slowBlock
   8.418 [test0 #1] starting step
   8.418 [test0 #1] starting background part of step
   8.418 [test0 #1] starting body
   8.419 [test0 #1] [Pipeline] {
   8.470 [test0 #1] body completed, starting background end part of step
   8.471 [test0 #1] ending step
   8.471 [test0 #1] [Pipeline] echo
   8.471 [test0 #1] At 3
   8.471 [test0 #1] [Pipeline] }
   8.472 [test0 #1] [Pipeline] // slowBlock
   8.523 [test0 #1] [Pipeline] slowBlock
   8.523 [test0 #1] starting step
   8.524 [test0 #1] starting background part of step
   8.524 [test0 #1] starting body
   8.525 [test0 #1] [Pipeline] {
   8.525 [test0 #1] body completed, starting background end part of step
   8.526 [test0 #1] ending step
   8.581 [test0 #1] [Pipeline] echo
   8.581 [test0 #1] At 4
   8.581 [test0 #1] [Pipeline] }
   8.582 [test0 #1] [Pipeline] // slowBlock
   8.582 [test0 #1] [Pipeline] slowBlock
   9.433 [test0 #1] starting step
   9.434 [test0 #1] starting background part of step
   9.435 [test0 #1] starting body

@dwnusbaum dwnusbaum marked this pull request as ready for review November 7, 2019 15:07
@@ -64,10 +64,10 @@
<properties>
<revision>2.21</revision>
<changelist>-SNAPSHOT</changelist>
<jenkins.version>2.121.1</jenkins.version>
<jenkins.version>2.138.4</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Means you can use the BOM if you like.

@dwnusbaum dwnusbaum merged commit 9afc27f into jenkinsci:master Nov 19, 2019
@dwnusbaum dwnusbaum deleted the JENKINS-58878 branch November 19, 2019 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants