develooper Front page | perl.perl5.porters | Postings from April 2018

Re: [perl #125106] Why are threads discouraged?

Thread Previous | Thread Next
Dave Mitchell
April 10, 2018 14:59
Re: [perl #125106] Why are threads discouraged?
Message ID:
On Tue, Apr 10, 2018 at 06:42:44AM -0700, Sergey Aleynikov via RT wrote:
> As for the core, I agree that it's now much more thread-stable than
> before. Somewhere around 5.12 or 5.14 I've prepared a talk named "no
> threads" with some nice crash examples in it - they crash no more. But
> still, locale handling was thread-unsafe until 5.24 (or 5.26?) - just
> because of no one has discovered that. And the following still fails
> loudly (though not dumps a core);
> while (1) {
>     push @foo, threads->create(sub {
>         require IO::Handle;
>     });
>     $_->detach for(splice @foo);
> }

Oh, that's fun, Looks like _create_getline_subs in IO.xs is directly
modifying the global PL_check[] rather than via the official API which
does the necessary locking.

> So while yes, perl is much more thread-safe inherently as it used to be,
> I won't recommend using threads in it to anyone.

Perl has bugs. Perl's threading has bugs. I haven't seen any particular
evidence yet that the number of threaded bugs is disproportionately large
on recent perls.

The Enterprise successfully ferries an alien VIP from one place to another
without serious incident.
    -- Things That Never Happen in "Star Trek" #7

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About