[Matplotlib-buildbot] buildbot failure in matplotlib on Ubuntu 8.04, Python 2.4, amd64

John Hunter wrote:

Andrew, the failure is on the font cache again -- is this the race
condition you've mentioned in the past?

matplotlib.tests.test_mathtext.test_mathtext_stixsans ... ok
Failure: IOError ([Errno 2] No such file or directory:
'/home/mpl-chslave/.matplotlib/fontList.cache') ... ERROR

line 942, in pickle_dump
    fh = open(filename, 'w')
IOError: [Errno 2] No such file or directory:

John, yes, this is the multiprocess race condition. I don't think the
issue is buildbot specific, but I can see that the use case may be rare
in which one process deletes the MPL directory after another had already
determined it is present. Nevertheless, I think it's something that
could happen in other circumstances, and I'm not sure the fontlist cache
file itself is multiprocess safe (I'm not saying it isn't -- I haven't

It does appear that a locking based solution is possible in a
cross-platform way, as sqlite says they do it in "Can multiple
applications or multiple instances of the same application access a
single database file at the same time?" at http://www.sqlite.org/faq.html .

I could put the builds in different user accounts so that the buildbot
wouldn't unintentionally continue to be hit with this bug. We could also
make a test case that starts multiple processes simultaneously using
subprocess to exercise the bug and mark it as known failing -- that way
we at least don't forget that it's an issue.

All that being said -- I don't mind the occasional buildbot failure
message -- it tells me that the buildbot is running and testing stuff.
One can always quickly re-fire the failed test manually from the
buildbot webpage to determine if this was the problem.