Tux / Text-CSV_XS

perl5 module for composition and decomposition of comma-separated values
17 stars 20 forks source link

Thread safety fixes #6

Closed dur-randir closed 7 years ago

Tux commented 7 years ago

@dur-randir With this merged (THANKS!), I still get intermittent failures in rt119 (your first example code)

This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux-thread-multi-ld
:
200
201
Thread 403 terminated abnormally: Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 30.
Global symbol "@ISA" requires explicit package name (did you forget to declare "my @ISA"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 31.
Global symbol "@EXPORT_OK" requires explicit package name (did you forget to declare "my @EXPORT_OK"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 32.
Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 33.
BEGIN not safe after errors--compilation aborted at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 40.
Compilation failed in require at rt119312.pl line 26.
202
203
204
:

And in a second run

649
650
651
Thread 1304 terminated abnormally: Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 30.
Global symbol "@ISA" requires explicit package name (did you forget to declare "my @ISA"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 31.
Global symbol "@EXPORT_OK" requires explicit package name (did you forget to declare "my @EXPORT_OK"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 32.
Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 33.
BEGIN not safe after errors--compilation aborted at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 40.
Compilation failed in require at rt119312.pl line 56.
Thread 1303 terminated abnormally: Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 30.
Global symbol "@ISA" requires explicit package name (did you forget to declare "my @ISA"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 31.
Global symbol "@EXPORT_OK" requires explicit package name (did you forget to declare "my @EXPORT_OK"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 32.
Global symbol "$VERSION" requires explicit package name (did you forget to declare "my $VERSION"?) at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 33.
BEGIN not safe after errors--compilation aborted at /pro/3gl/CPAN/Text-CSV_XS/blib/lib/Text/CSV_XS.pm line 40.
Compilation failed in require at rt119312.pl line 26.
thread crashed?
dur-randir commented 7 years ago

Really interesting. I've tested this on 5.10.1-thr (to get missing IO::Handle produce an actual error) and got clean runs, so I didn't bother about re-testing on a fresh perl. But it fails there still. I'll look further into it.

dur-randir commented 7 years ago

This is an instance of https://rt.perl.org/Ticket/Display.html?id=125685, which was broken by https://perl5.git.perl.org/perl.git/commit/986a805c4b258067b82c4f1254518e53cdb1acdf.

There're two ways around this - either load IO::Handle under mutex lock on perl >= 5.16.0 or restore some kind of require_IO_Handle macro - again, with added lock.