I have a multi-threaded program which calls make_path() and remove_tree(). I observed some occasional failure from subprocesses about missing working directory. Now I got a croak from remove_tree() that removing directory is not empty.
It happened that one thread started remove_tree() which made chdir(), then the other thread called and finished make_path(), and finally, the former thread continued in remove_tree() which failed because concurrent make_path() created relative directory tree into working directory changed by remove_tree().
All this is tread-unsafety is due to using chdir(). Working directory is a process attribute shared between threads.
It would be nice to reimplement File::Path without changing working directory. Or at least document this deficiency.

> I have a multi-threaded program which calls make_path() and
> remove_tree(). I observed some occasional failure from subprocesses
> about missing working directory. Now I got a croak from remove_tree()
> that removing directory is not empty.
>
> It happened that one thread started remove_tree() which made chdir(),
> then the other thread called and finished make_path(), and finally,
> the former thread continued in remove_tree() which failed because
> concurrent make_path() created relative directory tree into working
> directory changed by remove_tree().
>
> All this is tread-unsafety is due to using chdir(). Working directory
> is a process attribute shared between threads.
>
> It would be nice to reimplement File::Path without changing working
> directory. Or at least document this deficiency.

Richard Elberger and I have become co-maintainers of File-Path on CPAN, so the library is now under active maintenance. This problem is definitely on our radar.
Having given some study to this issues (which is also the subject of https://rt.cpan.org/Ticket/Display.html?id=99230), I think the *best* solution is to re-implement sub remove_tree() to remove its internal reliance on 'chdir'. But to do that, we -- and by that I mean not just the maintainers but all who have contributed to these RTs -- have to understand why 'chdir' was used as part of the implementation of remove_tree in the first place. As best I can tell, this was the commit to Perl 5 source code which first introduced this implementation:
#####
commit 0b3d36bd61fec90809936fcf1a90441d970d875e
Author: David Landgren <david@landgren.net>
Date: Sat Sep 8 12:46:15 2007 +0200
sync blead with File-Path 2.00_11
Message-ID: <46E26157.4050307@landgren.net>
p4raw-id: //depot/perl@31819
#####
David Landgren presumably had good reason to take this approach. So we have to understand what benefits that brought us in order to retain them as best as we can while we address the costs it also brought us.
Since all of the above, is non-trivial,
I recommend that in the short-run we adopt a *second best* solution of simply documenting the lack of thread safety.
Thank you very much.
Jim Keenan

For quite some time this limitation has been documented under:
BUGS AND LIMITATIONS > MULTITHREAD APPLICATIONS
I think we need to change the following text:
The implementation that surfaces this limitation may change in a future
release.
to:
The implementation that surfaces this limitation will not be changed.