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

Raise lock timeout as actual exception #6777

Merged
merged 2 commits into from Jul 25, 2016

Conversation

mdboom
Copy link
Member

@mdboom mdboom commented Jul 17, 2016

Fix #3655.

I haven't been able to directly reproduce #3655, so this is all based on theory, but given the symptoms and what we know about it, I'm reasonably certain about what is happening.

If a lock directory accidentally remains on disk in the ~/.cache/matplotlib directory from a previous run, it will wait around 90 seconds waiting for the lock to go away, and then timeout. When it times out, it simply tries again (once), and ultimately fails silently to write the file to disk.

The solution here is to:

  1. Make the timeout much shorter -- this only needs to live for the time it takes to write a ~1MB json file to disk
  2. Make the timeout a custom exception so we can handle it specially and let it bubble all the way out to the user (we still want to handle any other exception as a problem with font files and forcing a rebuild)

@mdboom mdboom added this to the 2.0 (style change major release) milestone Jul 17, 2016
@@ -2577,10 +2577,11 @@ def _putmask(a, mask, values):
return np.copyto(a, values, where=mask)

_lockstr = """\
LOCKERROR: matplotlib is trying to acquire the lock {!r}
LOCKERROR: matplotlib is trying to acquire the lock
{!r}
and has failed. This maybe due to any other process holding this
lock. If you are sure no other matplotlib process in running try
Copy link
Member

@QuLogic QuLogic Jul 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well fix it to say "is running", too.

@tacaswell
Copy link
Member

also closes #6721

@tacaswell
Copy link
Member

The 2.x branch still has the pickle code.

@mdboom
Copy link
Member Author

mdboom commented Jul 19, 2016

@tacaswell: This still seems to backport cleanly and correctly to 2.x, despite the use of pickle rather than json...

@mdboom
Copy link
Member Author

mdboom commented Jul 25, 2016

@tacaswell: I think this is ready for a final review.

@tacaswell tacaswell merged commit 38a32d9 into matplotlib:master Jul 25, 2016
tacaswell added a commit that referenced this pull request Jul 25, 2016
@QuLogic
Copy link
Member

QuLogic commented Aug 1, 2016

So this still needs a backport?

@tacaswell
Copy link
Member

I backportd this to v2.x as e691c28 (but forgot to note it, sorry).

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