Skip to content

Fix flaky tests (1) #5479

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

Closed
wants to merge 2 commits into from
Closed

Conversation

alexdowad
Copy link
Contributor

I have identified several other tests which fail intermittently, and intend to sort those out as well.

It has been observed that in rare cases, this regression test has spurious failures in CI.
Try increasing the threshold for failure a bit and see if this makes it pass consistently.
@alexdowad
Copy link
Contributor Author

Lots of CI failures on Azure. Looked at how Azure CI job works, and noted that it runs the test suite 3 times against the same test DB. Noticed that I wasn't cleaning out the renamed test table correctly and so the test would always fail on the 2nd and 3rd test run against the same DB.

Just seeing if I can fix that... if it works, will tidy code up a bit and squash commits.

@alexdowad
Copy link
Contributor Author

Trying something else. I think it should really kill this problem dead.

This test creates a MySQL table called 'test'. In several cases, I have seen a spurious
test failure (in CI) with an error message saying: "table 'test' already exists".

It may be that another test had used a table with the same name and not cleaned it out
correctly. Or maybe we have multiple tests running in parallel in some CI environments,
or the same test DB being used for multiple runs of the test suite.

In any case, change the table name so it is exclusive to this test case only. Also, if
the test table exists at the beginning of the test, drop it.
* Allow one more to account for a possible process switch. */
if ($moreThanLimit > 2) {
* Allow two more to account for possible process switch, etc. */
if ($moreThanLimit > 3) {
echo "fgets() took more than $max_ms ms $moreThanLimit times\n";
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you remember which builder this one failed on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've seen this one fail repeatedly. At least once on Travis CI, in the S390X environment, but I think I have seen it in other environments as well.

@elear
Copy link

elear commented Apr 29, 2020

@carusogabriel thanks for the mention. I am still relatively new to the PHP development process. I hope the PR is considered useful.

@elear
Copy link

elear commented Apr 29, 2020

I agree with @carusogabriel. Your PR is more comprehensive than mine. Looking forward to the merge.

@nikic
Copy link
Member

nikic commented Apr 29, 2020

I'll hijack this to collect flaky tests...

@@ -71,10 +71,15 @@ memory_limit=256M
printf("[011] Failed to change max_allowed_packet");
}

if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
$table_name = 'test__mysqli_insert_packet_overflow';
Copy link
Member

Choose a reason for hiding this comment

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

Why the double underscore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am having trouble articulating why I did that. Maybe I wanted 'test' to appear distinct from the name of the test case?

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Based on recent AppVeyor runs, it looks like we have identified and fixed the root cause of the issue. This should be fine to land now, but let's wait one more day.

@alexdowad
Copy link
Contributor Author

@nikic You identified the root cause? What was it?

@nikic
Copy link
Member

nikic commented Apr 29, 2020

@alexdowad See #5447 (comment) and following. The fix is 9a98569.

@alexdowad
Copy link
Contributor Author

session_module_name_variation4.phpt is a bad one. I have already spent a fair amount of time investigating it, but no results so far.

The other bad ones are the lstat tests and the FPM tests.

@cmb69
Copy link
Member

cmb69 commented Apr 29, 2020

I think I have seen session_module_name_variation4.phpt failing on AppVeyor occasionally as well.

@php-pulls php-pulls closed this in 7b32d17 May 1, 2020
@staabm
Copy link
Contributor

staabm commented May 1, 2020

Maybe we should change all tests creating a equal named table?
https://github.com/php/php-src/search?l=PHP&q=CREATE+TABLE+test

@nikic
Copy link
Member

nikic commented May 1, 2020

@staabm Unless there is interest in running mysql tests in parallel, unique test table names are not necessary.

@elear
Copy link

elear commented May 1, 2020

@nikic testing this patch now with a rebase of #5251.

@elear
Copy link

elear commented May 1, 2020

(and it passed! thanks!)

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.

6 participants