8000 Font cache thread safety · Issue #5226 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Font cache thread safety #5226
@timj

Description

@timj

The tests for the LSST software stack are run in parallel. We were getting failures roughly 10% of the time because of font cache directory creation issues. Looking at the code in font_manager.py we realised that setting $TRAVIS would fix our problem, which it did. This feels wrong though. It seems to me that this TRAVIS-specific bandaid is masking a more general problem with the cache. At the very least the environment variable being used to work around the problem should not be TRAVIS as the problem occurs any time two processes are trying to run matplotlib at the same time. Trying to explain why our test harness is forcing export TRAVIS=1 is challenging 😄

This is the trace without TRAVIS being set:

   import matplotlib.colorbar
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/colorbar.py", line 34, in <module>
    import matplotlib.collections as collections
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/collections.py", line 27, in <module>
    import matplotlib.backend_bases as backend_bases
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 56, in <module>
    import matplotlib.textpath as textpath
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/textpath.py", line 19, in <module>
    import matplotlib.font_manager as font_manager
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1415, in <module>
    _rebuild()
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/font_manager.py", line 1402, in _rebuild
    pickle_dump(fontManager, _fmcache)
  File "/home/vagrant/stack/Linux64/anaconda/2.2.0/lib/python2.7/site-packages/matplotlib/font_manager.py", line 952, in pickle_dump
    with open(filename, 'wb') as fh:
IOError: [Errno 2] No such file or directory: u'/tmp/matplotlib-vagrant/fontList.cache'

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0