8000 backend_pgf: improve handling of temporary directories by pwuertz · Pull Request #1286 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

backend_pgf: improve handling of temporary directories #1286

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

Merged
merged 4 commits into from
Oct 2, 2012
Merged

backend_pgf: improve handling of temporary directories #1286

merged 4 commits into from
Oct 2, 2012

Conversation

pwuertz
Copy link
Contributor
@pwuertz pwuertz commented Sep 20, 2012

Addresses #1281 where deleting temporary directories fails on Windows. Also, for multithread safety, stop using os.chdir.

@pwuertz
Copy link
Contributor Author
pwuertz commented Sep 20, 2012

@cgohlke Does this fix the problem on Windows?

@pwuertz
Copy link
Contributor Author
pwuertz commented Sep 20, 2012

Hmpf, sometimes pyhton can be a real pain. There is no way of designing a reliable destructor. Using atexit now for cleaning up the remaining temporary directories. I also removed the use of chdir when working with temp dirs, I think @cgohlke had some concern regarding multithreading.

@pwuertz
Copy link
Contributor Author
pwuertz commented Sep 22, 2012

I'm officially going insane. This new handling of temporary directories should be perfectly fine, but the situation on Windows just got a lot worse on my VM test system. I found an application called "ProcessExplorer" that can find and show the open file handles for each running process.

The problem on windows is that a spawned child process automatically inherits all open file descriptors and keeps them open as long as the subprocess is running. There is an option called close_fds that prevents this from happening, but if you enable that option there is no way of communicating with the process.

This is a really bad limitation, almost looks like a "won't fix". I don't even dare to imagine what this limitation means for multithreading support on Windows.

@pwuertz
Copy link
Contributor Author
pwuertz commented Sep 23, 2012

Ok, this is the best I can do for now :). Unfortunately on Windows the only real solution is not to inherit fds when spawning a subprocess and then to develop another way of inter-process communication. I don't see how this can be done with stdin/stdout on Windows...

@dmcdougall
Copy link
Member

@pwuertz Are you happy with this pull request? I'm not a Windows guy, but this is milestoned for 1.2.x. Should it be merged?

@pwuertz
Copy link
Contributor Author
pwuertz commented Oct 2, 2012

@dmcdougall I'm not really happy, but I don't see another solution right now. I'm not a Windows guy either, pretty demoralized by the limitations I encountered and hoped for some feedback that magically solves the problem. Let me just add some warning in the documentation and then this PR is good to go.

@pwuertz
Copy link
Contributor Author
pwuertz commented Oct 2, 2012

Ok, forwarding the discussion / solution to #1324. This PR should be good for 1.2 now.

dmcdougall added a commit that referenced this pull request Oct 2, 2012
backend_pgf: improve handling of temporary directories
@dmcdougall dmcdougall merged commit 7326b94 into matplotlib:v1.2.x Oct 2, 2012
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.

2 participants
0