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

Trying to fix "reactor unclean" test fails #94

Merged
merged 2 commits into from May 15, 2015

Conversation

IlyaSkriblovsky
Copy link
Contributor

I've looked into sporadically failed tests and found that this happens for tests that create MongoConnection and immediately call its disconnect() without issuing any queries. MongoConnection() constructor starts connecting in background. Connection process in turn starts name resolution of "localhost" into ip-address. If name resolution doesn't finish until disconnect() returns (it takes exactly 1 main loop round-trip), trial fails with "reactor unclean". (Name resolution is deferred to separate thread, so there is race condition which fails more often on slow machines).

Unfortunately, I didn't found any good way to wait until name resolution is done :(

The simpliest way to solve this is to change "localhost" to "127.0.0.1" in test_queries.py, test_aggregate.py and test_connection.py. Or to issue any command on MongoConnection in corresponding test methods.

After changing "localhost" to "127.0.0.1" I'm not able to reproduce this anymore.

Lets see what Travis will say

issuing any queries. This would fix "reactor unclean" unittests fails.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 78.96% when pulling 71d73d9 on IlyaSkriblovsky:fix-trial-reactor-unclean into 04c8f56 on twisted:master.

@IlyaSkriblovsky
Copy link
Contributor Author

Ouch. This is another fail, not covered by this PR. This TimeoutError looks like solely by low performance of Travis' VM.

There are explicitly set timeout = 5 for all testcases in test_queries.py. What are they for? Can we simply drop them?

@IlyaSkriblovsky
Copy link
Contributor Author

But there is no fails due to unfinished name resolution anymore :-)

@coveralls
Copy link

Coverage Status

Coverage remained the same at 78.96% when pulling a21fb13 on IlyaSkriblovsky:fix-trial-reactor-unclean into 04c8f56 on twisted:master.

@IlyaSkriblovsky
Copy link
Contributor Author

@psi29a can you restart tests manually a couple of times to prove there will be no random fails anymore?

@psi29a
Copy link
Contributor

psi29a commented May 15, 2015

I'm merging this because it works, apparently it failed last because of my pull request I merged in.

psi29a added a commit that referenced this pull request May 15, 2015
Trying to fix "reactor unclean" test fails
@psi29a psi29a merged commit 97bc395 into twisted:master May 15, 2015
@IlyaSkriblovsky
Copy link
Contributor Author

Yeah, it seems like something messed with multiple versions of source code

@IlyaSkriblovsky IlyaSkriblovsky deleted the fix-trial-reactor-unclean branch May 15, 2015 07:25
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.

None yet

3 participants