-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
mathtext/mathfont intermittent failures #7911
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
Comments
I'm not sure I follow this 100%, but just a thought looking at the caching in text.py and mathtext.py: def get_prop_tup(self, renderer=None):
"""
Return a hashable tuple of properties. ...
"""
x, y = self.get_unitless_position()
return (x, y, self.get_text(), self._color,
self._verticalalignment, self._horizontalalignment,
hash(self._fontproperties),
self._rotation, self._rotation_mode,
self.figure.dpi, id(renderer or self._renderer),
) def parse(self, s, dpi = 72, prop = None):
...
cacheKey = (s, dpi, hash(prop))
result = self._cache.get(cacheKey)
if result is not None:
return result Both use |
In these tests, the |
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
Suspect it as a new render which has the same id ( https://stackoverflow.com/questions/20753364/why-is-the-id-of-a-python-class-not-unique-when-called-quickly and I have hit this at my day-job). The fix looks like it is give renderers some sort of unique id ( |
Exact work:
|
Testing this is hard given that it relies on triggering a race condition inside of cpython. |
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
See matplotlib#7911 for why these tests are flaky and matplotlib#7107 for why they are not so easy to fix.
Any progress here? It seems to me that around half of the daily wheel build / test runs fail with one of these errors - I mean, there's one run in the build matrix that fails, meaning I have to go and restart that build manually. |
On |
Yes, on master. This is using pytest. |
Errors continue, at or around 50% of build runs. Here's the latest build matrix: https://travis-ci.org/MacPython/matplotlib-wheels/builds/234736344 Failure build log: https://travis-ci.org/MacPython/matplotlib-wheels/jobs/234736346 This is another plea for a progress update, it's tiring to restart builds by hand every other day. |
Intermittent test failures - see: matplotlib/matplotlib#7911. Install pytest-rerunfailures to trigger rebuild on failure.
I've added |
I suspect that this failure is rare in real life as it is a consequence of running a somewhat pathological test where all of these values are the same:
but with different renderers and rapidly changing rcParams. For what ever reason, these collisions seem to happen far more often on travis than on my machines. I assume this has something to do with travis being all VMs and / or low memory? |
Ah, I thought you were already using the rerunfailures plugin; that's what cut down on the failures on It's a bit of a hack, but what if we empty |
I'm opening this as an issue separate from #6586 to better document the investigation into the root cause. This affects both the
v2.0.x
andmaster
branches.We can make the failures a bit more reproducible by repeating the tests a bit. What I did was the following:
mathfont_*_08
)test_mathtext.py
to drop the other tests and run only08
100 times over.Text._get_layout
to print out whether the cache hit worked or failed.In the end, you will get about 2 or 3 failures out of the 500. On the failures, the cache returns a value. It turns out that every once in a while, the renderer will have the same ID (or be the same one, I don't know). Since the cache key does not include the mathtext fontset, the cached value will be for some other one and thus be in the wrong place.
I'm not sure how to easily fix this. Ideally, the fontset would be part of the key, but it's not actually used by
Text
objects, but theMathTextParser
. According to #7107, baking thercParam
directly into initialization is a hard problem. Maybe we should find a way to disable the cache during test?The text was updated successfully, but these errors were encountered: