Bug#889734: libjson-xs-perl: JSON::XS is broken in multithreaded programs

gregor herrmann gregoa at debian.org
Sat Feb 10 20:18:21 UTC 2018


Control: tag -1 + upstream wontfix

On Tue, 06 Feb 2018 15:34:49 +0100, Łukasz Stelmach wrote:

> The following program exposes a bug in JSON::XS module which makes the
> program die.
> 
> --8<---------------cut here---------------start------------->8---
> #!/usr/bin/perl
> 
> use JSON;
> use threads;
> 
> my $thnum = int($ARGV[0]);
> 
> $href{"foo"} = "bar";
> 
> for (1..$thnum) {
>         threads->create(sub { print "quick thread\n" });
> }
> foreach (threads->list()) { $_->join(); }
> 
> print to_json(\%href);
> --8<---------------cut here---------------end--------------->8---
> 
> For any number of threads other than 0 (e.g. "perl prog.pl 1") the
> program dies printing[1]

This is a know and documented limitation:

(I-)THREADS
    This module is *not* guaranteed to be ithread (or MULTIPLICITY-) safe
    and there are no plans to change this. Note that perl's builtin
    so-called theeads/ithreads are officially deprecated and should not be
    used.

Given this statement by upstream, it doesn't look like they're going
to change this behaviour …


Cheers,
gregor

-- 
 .''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
 : :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
 `. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
   `-   NP: Dire Straits: Ride Across The River
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 963 bytes
Desc: Digital Signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-perl-maintainers/attachments/20180210/917912d1/attachment-0001.sig>


More information about the pkg-perl-maintainers mailing list