-
-
Notifications
You must be signed in to change notification settings - Fork 79
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
Problems with threads #24
Comments
Yikes! I have some questions:
Tomorrow I'll try and replicate this on Fedora and Ubuntu. |
|
@ncoghlan, do you have any idea why this is happening? I can't reproduce it on Mac OS X or on the CI server. |
I was able to reproduce it without Docker on Fedora 22 - same symptoms as @vpavlin, with only 4 entries in the cache rather than the expected 5. Dependencies were installed in the virtualenv via "pip -r requirements.txt". Looking at the test case, I'm not seeing anything wrong except that I'm not sure the block comment is right about there being a race condition: run_threads() joins all the created threads before returning, so "cached_total" should always have been updated correctly before the assertions are checked. |
Running The particular case that failed there was the one in test_threads_ttl (using freeze_time). The first failure I saw was in test_threads. Fedora does patch the threading module, but we shouldn't be hitting that code since we aren't passing a timeout to Thread.wait: http://pkgs.fedoraproject.org/cgit/python.git/tree/00181-allow-arbitrary-timeout-in-condition-wait.patch |
Oh, now I understand that block comment in test_threads - I didn't realise what cached_property actually did :) In that case, I suppose it's possible that for some reason one of the threads is dragging its feet and not starting running until after one of the other threads has already shadowed the property with a normal value. |
I'm heading out, but I've kicked off a test run using this modified implementation of run_threads in the tests:
That means the sleep in the cached property test is only covering the threads reacting to the event being signalled, rather than actually starting them. (There's still be a problem to report to the Fedora python and/or kernel teams though, so it would be weird for 5 threads to be taking an entire second to all start) |
Even with that modified implementation, that still failed within 28 runs of the test suite. I'd suggest pinging the Fedora python-devel list at this point. |
@ncoghlan Do you want me to do it, or will you? (Anyway thanks for looking at this) |
@vpavlin I was suggesting you do that. I'm now assuming there's something odd in the Fedora Python patches, and I'm the wrong person to ask about that. |
@rkuska asked me to file a bug against python in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1261445 |
We just moved cached-property's Travis builds to use the container-based infrastructure. There, we ran into what appears to be the same issue: https://travis-ci.org/pydanny/cached-property/jobs/93074100 |
I got a similar bug report for the Gentoo Ebuild: https://bugs.gentoo.org/638250 |
Is this still an issue? All current tests are passing: https://travis-ci.org/pydanny/cached-property |
With 1.5.1:
Perhaps Travis CPU isn't loaded enough for the race to trigger? |
* Mask problematic 'test_threads_ttl_expiry' test fails with high core count: pydanny/cached-property#24 Bug: https://bugs.gentoo.org/638250 Package-Manager: Portage-3.0.3, Repoman-3.0.0 Signed-off-by: David Seifert <[email protected]>
* Mask problematic 'test_threads_ttl_expiry' test fails with high core count: pydanny/cached-property#24 Bug: https://bugs.gentoo.org/638250 Package-Manager: Portage-3.0.3, Repoman-3.0.0 Signed-off-by: David Seifert <[email protected]>
Hi, I wanted to extend your project so I created a Dockerfile to run tests in container. I did some modifications and when I ran tests they failed from time to time. So I reverted my changes and ran it again against current
HEAD
.See results here http://pastebin.centos.org/34206/
Simply put, tests for threading randomly fail - in this case in 6th run. I am not very familiar with multi threaded applications, but will be happy to assist with debugging.
The text was updated successfully, but these errors were encountered: