Skip to content

bpo-30317: Fix multiprocessing test_timeout() - #8621

Merged
pablogsal merged 1 commit into
python:masterfrom
vstinner:mp_timeout
Aug 3, 2018
Merged

pablogsal merged 1 commit into
python:masterfrom
vstinner:mp_timeout

Conversation

@vstinner

@vstinner vstinner commented Aug 2, 2018 •

Copy link
Copy Markdown
Member

Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.

https://bugs.python.org/issue30317

Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

Note: Python 2.7 doesn't have the test and so is not affected.

@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

@pablogsal: Would you mind to review my change? If it looks good to you, please merge it. Just don't forget to replace #xxx with GH-xxx in the commit message when you merge the change :-)

Then you can wait for @miss-inlington to generate the backports, to approve the backports. If the bot fails to generate the backports, I will do it manually.

@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

Honestly, I'm not really happy to have to tolerate a delta of -100 ms on a wait of 200 ms, it's -50%! But I don't see what else can be done here. It's related to weak resolution of clocks on Windows, but I don't want to have a different clock resolution depending on the platform.

# bpo-30317: Tolerate a delta of 100 ms because of the bad clock
# resolution on Windows (usually 15.6 ms). x86 Windows7 3.x once
# failed because the delta was only 135.8 ms.
self.assertGreaterEqual(delta, 0.100)

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.

Could we use the more permissive delta only when this test is being executed on Windows? It complicates the test a bit (two different values for the check) but it will not be permissive in all platforms, only in the ones with a bad clock resolution (Windows). What do you think?

@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

Could we use the more permissive delta only when this test is being executed on Windows? It complicates the test a bit (two different values for the check) but it will not be permissive in all platforms, only in the ones with a bad clock resolution (Windows). What do you think?

I tried a generic more complex option in regrtest, but @pitrou didn't like the idea. If you want to do something, IMHO it should not only be done in one specific test, but be a parameter of regrtest. For this specfic change, I would prefer to just change the timeout.

@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

Oh. I succeeded to find my old issue to make "sleep configurable": https://bugs.python.org/issue20910

@vstinner

vstinner commented Aug 2, 2018

Copy link
Copy Markdown
Member Author

In short, I abandoned this approach and instead use the maximum timeout of all buildbots and put it in tests. It's not perfect, but it works :-)

@pablogsal

Copy link
Copy Markdown
Member

@vstinner I personally like the "configurable sleep" approach, but yeah, that certainly needs much more discussion /separate forum that this PR. Thank you for the link to https://bugs.python.org/issue20910!

@pablogsal
pablogsal merged commit 5640d03 into python:master Aug 3, 2018
@miss-islington

Copy link
Copy Markdown
Contributor

Thanks @vstinner for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington

Copy link
Copy Markdown
Contributor

Sorry @vstinner and @pablogsal, I had trouble checking out the 3.6 backport branch.
Please backport using cherry_picker on command line.
cherry_picker 5640d030e100aade54210034828b711c3b506b18 3.6

@bedevere-bot

Copy link
Copy Markdown

GH-8637 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 3, 2018
Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
(cherry picked from commit 5640d03)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
pablogsal pushed a commit to pablogsal/cpython that referenced this pull request Aug 3, 2018
Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
(cherry picked from commit 5640d03)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@bedevere-bot

Copy link
Copy Markdown

GH-8638 is a backport of this pull request to the 3.6 branch.

miss-islington added a commit that referenced this pull request Aug 3, 2018
Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
(cherry picked from commit 5640d03)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
pablogsal added a commit that referenced this pull request Aug 3, 2018
Multiprocessing test_timeout() now accepts a delta of 100 ms instead
of just 50 ms, since the test failed with 135.8 ms instead of the
expected 200 ms.
(cherry picked from commit 5640d03)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
@vstinner
vstinner deleted the mp_timeout branch September 19, 2018 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants