std::thread::detach() rarely crashes in Parallel.cpp

Andrew Ng via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 10:50:17 PST 2017


Hi,

As I mentioned earlier, I had been looking into various issues with the
std::thread based implementation of the ThreadPoolExecutor running on
Windows. The main reason for this is that we have been seeing a lot of
crashes during exit when using the MS Concurrency Run-time based executor
in combination with the MSVC static debug CRT.

I have created the following patch based on my work so far:

  https://reviews.llvm.org/D40366

This appears to resolve the issues we've experienced on Windows and has
been tested on Linux too. However, we've never seen any issues on Linux,
even before these changes.

Takumi, is there any chance you could try out this patch to see if it helps
resolve your issue?

Regards,
Andrew


On 7 November 2017 at 16:59, Rafael Avila de Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> NAKAMURA Takumi <geek4civic at gmail.com> writes:
>
> > Rafael, I tried a few stories you suggested.
> >
> > 1) Launch noop(return nullptr) and detach it in main context
> > I saw crash in pthread_detach.
> >
> > 2) Avoid grandchildren. Just launch threads in main context.
> > I couldn't happen crash in a million run.
> > Note, it's a devil's proof.
>
> Care to benchmark that and send for review?
>
> Cheers,
> Rafael
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171122/ad7fda59/attachment.html>


More information about the llvm-commits mailing list