Skip to content

fix for ticket:2951: wait for the logs are created before finishing the step#1296

Merged
sa2ajj merged 4 commits intobuildbot:masterfrom
tardyp:t2951
Oct 28, 2014
Merged

fix for ticket:2951: wait for the logs are created before finishing the step#1296
sa2ajj merged 4 commits intobuildbot:masterfrom
tardyp:t2951

Conversation

@tardyp
Copy link
Copy Markdown
Member

@tardyp tardyp commented Oct 26, 2014

There is a race condition between addLogs calls, and the end of the step.

for oldStyleSteps, this matters, because the subsequent addStderr, are only called
at the end of the step, so we must wait for log are created before continuing

Signed-off-by: Pierre Tardy pierre.tardy@intel.com

There is a race condition between addLogs calls, and the end of the step.

for oldStyleSteps, this matters, because the subsequent addStderr, are only called
at the end of the step, so we must wait for log are created before continuing

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
@sa2ajj sa2ajj changed the title potencial fix for #2951: wait for the logs are created before finishing the step potencial fix for ticket:2951: wait for the logs are created before finishing the step Oct 27, 2014
@sa2ajj
Copy link
Copy Markdown
Contributor

sa2ajj commented Oct 27, 2014

👍

Do you think we need a test case for this?

@tardyp
Copy link
Copy Markdown
Member Author

tardyp commented Oct 27, 2014

Well, I do think so. I'd like to first have it tested by @benallard.

The unit test will be a little bit hacky though, pretty unavoidable for testing race-conditions.

@tardyp tardyp changed the title potencial fix for ticket:2951: wait for the logs are created before finishing the step fix for ticket:2951: wait for the logs are created before finishing the step Oct 27, 2014
@tardyp
Copy link
Copy Markdown
Member Author

tardyp commented Oct 27, 2014

added a testcase for this problem

@sa2ajj
Copy link
Copy Markdown
Contributor

sa2ajj commented Oct 27, 2014

Fortunately, only pyflakes/pylint errors.

@benallard
Copy link
Copy Markdown
Contributor

So far, I was not able to get any exception any more in my status pages !

add a test for the case which the db is too slow to complete the newLog before end of the step

if I revert previous commit, I get the error reported by benallard

===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 157, in next
    self._catchup()
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 159, in _catchup
    self.step._start_unhandled_deferreds.append(d)
exceptions.AttributeError: 'NoneType' object has no attribute 'append'

buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB
buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB
===============================================================================
[ERROR]
Traceback (most recent call last):
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 135, in gotAsync
    self._catchup()
  File "/Users/ptardy/dev/bb/buildbot-heroku/buildbot/master/buildbot/process/buildstep.py", line 159, in _catchup
    self.step._start_unhandled_deferreds.append(d)
exceptions.AttributeError: 'NoneType' object has no attribute 'append'

buildbot.test.integration.test_custom_buildstep.RunSteps.test_OldStyleCustomBuildStepSlowDB

Signed-off-by: Pierre Tardy <pierre.tardy@intel.com>
@tardyp
Copy link
Copy Markdown
Member Author

tardyp commented Oct 27, 2014

yeah!!

just fixed the silly import errors..

@sa2ajj
Copy link
Copy Markdown
Contributor

sa2ajj commented Oct 27, 2014

I do not find them to be silly: less imports less maintenance burden :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I love the fix, but this has me worried because it's using clock time to determine which side of a race wins. Could you add a hook at the beginning of finally block run run, and use that hook to call reactor.callLater(0, delayed) in the tests? That would mean that newLog doesn't return until the reactor iteration after the yield statement.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

could you be more specific, on how you would write this hook. I can't think of any solution that wouldn't be horribly intrusive.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If that's OK by you, cherry-pick it into this pull req, or let me know and I'll merge both.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0%) when pulling 4721f54 on tardyp:t2951 into 0eedf8c on buildbot:master.

djmitche and others added 2 commits October 28, 2014 09:48
@tardyp
Copy link
Copy Markdown
Member Author

tardyp commented Oct 28, 2014

includes @djmitche 's hook. I improved it to use assert, so that it is optimized out in prod.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0%) when pulling fc2e28c on tardyp:t2951 into 0eedf8c on buildbot:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.0%) when pulling fc2e28c on tardyp:t2951 into 0eedf8c on buildbot:master.

sa2ajj pushed a commit that referenced this pull request Oct 28, 2014
fix for ticket:2951: wait for the logs are created before finishing the step
@sa2ajj sa2ajj merged commit dae7c83 into buildbot:master Oct 28, 2014
@benallard
Copy link
Copy Markdown
Contributor

Thanks !

@tardyp tardyp deleted the t2951 branch April 24, 2016 13:41
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.

5 participants