question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fix flaky tests that are recently popping up

See original GitHub issue

Since https://github.com/pytorch/vision/pull/4497 was merged, we’re observing a few tests that start randomly failing.

Before https://github.com/pytorch/vision/pull/4497, these tests were almost always using the same RNG state, which was set in a test that was run earlier in the test execution suite. Now that all tests are properly independent and that the RNG doesn’t leak, these tests run with a new RNG at each execution, and if they’re unstable they might fail.

(Note: this is a good thing; it’s better to know that they fail now rather than when submiting an unrelated PR, which is what happened in https://github.com/pytorch/vision/pull/3032#issuecomment-734829336)

For each of these tests we should find out whether the flakyness is severe or not. A simple solution is to parametrize the test over 100 or 1000 random seeds and check the failure rate. If the failure rate is reasonable we can just set a seed with toch.manual_seed(). If not, we should try to fix the test and make it more robust.

The list of tests so far is:

cc @pmeier

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
datumboxcommented, Oct 27, 2021

It’s the unstable sort. See https://github.com/pytorch/vision/pull/4766#issuecomment-952996259

I think it’s worth understanding why the open-source contributor couldn’t make the sort stable (he was facing seg fault if I remember correctly). Fixing the sort will fix lots of instability on the Detection models, so definitely worth while.

1reaction
NicolasHugcommented, Oct 27, 2021

It would be interesting to figure out whether the 6 failures correspond to a specific edge-case, but I wouldn’t spend too much time on it either.

It could just be some ties in the sorting (which is not a stable sort)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Deal with Flaky Tests - The New Stack
Luckily, there are viable methods to eliminate flakiness from your tests. Rerun your tests multiple times, change their execution order, and ...
Read more >
How to reduce flaky test failures - CircleCI
Find out whether your tests are flaky and learn how to fix them.
Read more >
7 steps for fixing flaky tests - Vesko Iliev
7 steps for fixing flaky tests · 1. Error message, logs & stacktrace. The first step is to collect as much information about...
Read more >
Tips for Fixing Your Flaky Tests - HackerNoon
Learn how to get better consistency around your automated tests by both fixing your existing flaky tests, and writing better tests going ...
Read more >
A Practical Guide to Reducing the Burden of Flaky Tests
Flaky tests can be frustrating and detrimental to your testing efforts. This post covers what causes flaky tests and what you can do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found