Skip Menu |

This queue is for tickets about the Dios CPAN distribution.

Report information
The Basics
Id: 123015
Status: open
Priority: 0/
Queue: Dios

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.002011
Fixed in: (no value)



Subject: Segmentation faults and bus errors
The test suite started to fail with segfaults or bus errors: ... $ perl5.24.3-RC1 -Mblib t/attributes_typed.t 1..5 ... ok 4 - hoi_attr tests # Subtest: Direct assignment [4] 9439 segmentation fault (core dumped) perl5.24.3-RC1 -Mblib t/attributes_typed.t $ gdb perl5.24.3-RC1 core ... Core was generated by `perl5.24.3-RC1 -Mblib t/attributes_typed.t'. Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00007f717ea164a8 in vmg_find.isra () from /opt/perl-5.24.3-RC1/lib/site_perl/5.24.3/x86_64-linux/auto/Variable/Magic/Magic.so (gdb) bt #0 0x00007f717ea164a8 in vmg_find.isra () from /opt/perl-5.24.3-RC1/lib/site_perl/5.24.3/x86_64-linux/auto/Variable/Magic/Magic.so #1 0x00007f717ea198fd in XS_Variable__Magic_cast () from /opt/perl-5.24.3-RC1/lib/site_perl/5.24.3/x86_64-linux/auto/Variable/Magic/Magic.so #2 0x00000000004b62c8 in Perl_pp_entersub () #3 0x00000000004aeca3 in Perl_runops_standard () #4 0x0000000000442611 in perl_run () #5 0x00000000004202f5 in main () It seems that there's no perl version/operating system pattern: http://fast-matrix.cpantesters.org/?dist=Dios%200.002011
Subject: Re: [rt.cpan.org #123015] Segmentation faults and bus errors
Date: Mon, 25 Sep 2017 11:57:44 +1000
To: bug-Dios [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Other systems are seeing the same problems, which I suspect are caused by PPR. However, I cannot replicate the issue on any system I have access to. I'm not sure how to proceed. Damian
I ran into the same issue. On Sun Sep 24 21:58:40 2017, damian@conway.org wrote: Show quoted text
> Other systems are seeing the same problems, > which I suspect are caused by PPR.
I think that that's not what's happening. Show quoted text
> However, I cannot replicate the issue on any > system I have access to.
I changed t/attributes_typed.t slightly by sticking "use Keyword::Declare {debug=>1};" at the top (see attributes_typed.t-ouput). I hope this helps a bit. Playing around some more, I see that the segfault occurs before any of the tests in direct_assignment() get run. Indeed, the segfault can be triggered by running the code in dios-segfault.pl. Indeed, it looks like the crash occurs in Variable::Magic::wizard(). Show quoted text
> I'm not sure how to proceed.
If you can think of more and more helpful ways to debug this, I'd be more than happy to assist. Unfortunately, I know nothing about Variable::Magic or what Dios::Types is using it for, so a certain level of patience may be needed.
Subject: attributes_typed.t-ouput
Download attributes_typed.t-ouput
application/octet-stream 10.5k

Message body not shown because it is not plain text.

Subject: dios-segfault.pl
use Dios; sub direct_assignment { my $int_attr = 10; Dios::Types::_set_var_type( q{Int}, \$int_attr, 'Value (%s) for $int_attr attribute', sub { $_ > 0 } ); } direct_assignment();
I tried to install Dios and run into this (or a similar) problem. Some tests fail randomly with segfault. Here is one example: $ perl -Ilib t/subtype_in_class.t 1..6 ok 1 ok 2 Speicherzugriffsfehler (Speicherabzug geschrieben) $ perl -Ilib t/subtype_in_class.t 1..6 ok 1 ok 2 Speicherzugriffsfehler (Speicherabzug geschrieben) $ perl -Ilib t/subtype_in_class.t 1..6 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 $ perl -Ilib t/subtype_in_class.t 1..6 ok 1 ok 2 Speicherzugriffsfehler (Speicherabzug geschrieben) $ perl -Ilib t/subtype_in_class.t 1..6 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 How can i help to fix this? Have a nice day Felix ----------------------- $ perl -v This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux (with 1 registered patch, see perl -V for more detail) Copyright 1987-2015, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
I installed every perl mayor-release from 5.14 to 5.28 and here are the testresults (or the essence): = segfault problem === for perl <= 5.16 * no segfault === for perl == 5.18 * segfault for dios_segfault.t === for perl == 5.20 Not working on my machine / out of memory (6GB) === for perl >= 5.22 and <= 5.26 * segfault for dios_segfault.t * segfault for t/attributes_typed.t -> Subtest: Direct assignment * randomly segfault for t/subtype_in_class.t === for perl >= 5.28 * segfault for dios_segfault.t * randomly segfault for t/subtype_in_class.t = other problems === for perl <= 5.24 and t/caller.t t/caller.t for perl <= 5.24 produce a strange warning: $ perl -Ilib t/caller.t ok 1 ok 2 ok 3 ok 4 1..4 The plan was already output at /home/felixostmann/perl5/perlbrew/perls/perl-5.24.4/lib/5.24.4/Test/Builder.pm line 2510. 1..4 === for perl == 5.18 and every 'Name correct'-Tests # Failed test 'Name correct' # at t/attributes_basic.t line 29. # got: 'Pl�' # expected: 'Damian' === for perl >= 5.18 and every 'Accessed class's name correctly'-Test # Failed test 'Accessed object's name correctly' # at t/shared.t line 29. # got: '�K2' # expected: 'Demo' === for perl >= 5.18 and every 'Invalid assignment to $name'-Test # Failed test 'Invalid assignment to $name' # at t/lexical.t line 40. === for perl >= 5.28 and 'Direct assignment'-Test # Failed test 'Int attr 0 assignment failed as expected' # at t/attributes_typed.t line 15. # Failed test 'Int attr str assignment failed as expected' # at t/attributes_typed.t line 16. # Failed test 'AoN attr assignment failed as expected' # at t/attributes_typed.t line 19. = output from Devel::Trace for 5.22 and t/subtype_in_class.t with segfault: ... Show quoted text
>> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:370: $wiz = eval { _wizard(map $opts{$_}, @keys) }; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:371: $err = $@; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:373: if ($err) { >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:382: return $wiz;
Speicherzugriffsfehler (Speicherabzug geschrieben) Without segfault: ... Show quoted text
>> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:370: $wiz = eval { _wizard(map $opts{$_}, @keys) }; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:371: $err = $@; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:373: if ($err) { >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:382: return $wiz; >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> lib/Dios/Types.pm:712: my ($typename, $value) = splice(@_,0,2); >> lib/Dios/Types.pm:713: my ($value_desc, @constraints); >> lib/Dios/Types.pm:714: for my $arg (@_) { >> lib/Dios/Types.pm:716: if (ref($arg) eq 'CODE') { >> lib/Dios/Types.pm:722: $value_desc .= $arg; >> lib/Dios/Types.pm:727: local $Dios::Types::lexical_hints = (caller 0)[10] // {};
...
OK, please ignore the above. I guess that was simple bad luck (or my manually testcase was to weak) = segfault problem === for perl <= 5.16 * no segfault === for perl == 5.18 * segfault for dios_segfault.t === for perl == 5.20 Not working on my machine / out of memory (6GB) === for perl >= 5.22 * segfault for dios_segfault.t * randomly segfault for t/attributes_typed.t -> Subtest: Direct assignment * randomly segfault for t/subtype_in_class.t = other problems === for perl <= 5.24 and t/caller.t $ perl -Ilib t/caller.t ok 1 ok 2 ok 3 ok 4 1..4 The plan was already output at /home/felixostmann/perl5/perlbrew/perls/perl-5.24.4/lib/5.24.4/Test/Builder.pm line 2510. 1..4 === for perl == 5.18 and every 'Name correct'-Tests # Failed test 'Name correct' # at t/attributes_basic.t line 29. # got: 'Pl�' # expected: 'Damian' === for perl >= 5.18 and every 'Accessed class's name correctly'-Test # Failed test 'Accessed object's name correctly' # at t/shared.t line 29. # got: '�K2' # expected: 'Demo' === for perl >= 5.18 and every 'Invalid assignment to $name'-Test # Failed test 'Invalid assignment to $name' # at t/lexical.t line 40. === for perl >= 5.22 and 'Direct assignment'-Test # Failed test 'Int attr 0 assignment failed as expected' # at t/attributes_typed.t line 15. # Failed test 'Int attr str assignment failed as expected' # at t/attributes_typed.t line 16. # Failed test 'AoN attr assignment failed as expected' # at t/attributes_typed.t line 19. = output from Devel::Trace for 5.22 and t/subtype_in_class.t with segfault: ... Show quoted text
>> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:370: $wiz = eval { _wizard(map $opts{$_}, @keys) }; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:371: $err = $@; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:373: if ($err) { >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:382: return $wiz;
Speicherzugriffsfehler (Speicherabzug geschrieben) Without segfault: ... Show quoted text
>> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:370: $wiz = eval { _wizard(map $opts{$_}, @keys) }; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:371: $err = $@; >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:373: if ($err) { >> /home/felixostmann/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/x86_64-linux/Variable/Magic.pm:382: return $wiz; >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> t/subtype_in_class.t:18: >> lib/Dios/Types.pm:712: my ($typename, $value) = splice(@_,0,2); >> lib/Dios/Types.pm:713: my ($value_desc, @constraints); >> lib/Dios/Types.pm:714: for my $arg (@_) { >> lib/Dios/Types.pm:716: if (ref($arg) eq 'CODE') { >> lib/Dios/Types.pm:722: $value_desc .= $arg; >> lib/Dios/Types.pm:727: local $Dios::Types::lexical_hints = (caller 0)[10] // {};
...
RT-Send-CC: damian [...] conway.org
With gdb I see a problem in XS_Variable__Magic_cast when running t/attributes_typed.t, within "Subtest: Direct assignment" ... 2044 RETVAL = newSVuv(vmg_cast(SvRV(sv), w, wiz, args, i)); (gdb) p Perl_sv_dump(sv) SV = PVIV(0x7cf288) at 0x14eb0b8 REFCNT = 4 FLAGS = (IOK,POK,pIOK,pPOK) IV = 42 PV = 0x157ef90 "42"\0 CUR = 2 LEN = 10 A SvRV() on a non-reference won't work and probably causes the following segfaults.
Another short test: I had a fresh FreeBSD installation somewhere and the bevavior for perl-5.28 is the same (as for Ubuntu 16.04)
Fix for unrelated problem Nr. 1: === for perl <= 5.24 and t/caller.t $ perl -Ilib t/caller.t ok 1 ok 2 ok 3 ok 4 1..4 The plan was already output at /home/felixostmann/perl5/perlbrew/perls/perl-5.24.4/lib/5.24.4/Test/Builder.pm line 2510. 1..4 This is the only test with "use Test::More 'no_plan';" and "done_testing();" at the end. All other tests use "no_plan" or "done_testing". The prefered solution should be "done_testing". From the Test::More documentation: =item B<done_testing> ... This is safer than and replaces the "no_plan" plan.
Perhaps i found the probleme ... see here: https://rt.cpan.org/Ticket/Display.html?id=127572&results=83f8638d0217da8020e5677b8ed2fb61 TL;DR: "require Variable::Magic" -> Segfault VS "use Variable::Magic" -> all fine
Attached a patch to change every "use Test::More 'no_test';" to "use Test::More; ... done_testing;" With this patch every major release since 5.14 works as expected! One important thing: To easy test this, you can't use "prove -MVariable::Magic -Ilib t/"! Yeah, correct guessed: prove use require to provide -M ;) Use the following snippet: prove --exec 'perl -MVariable::Magic -Ilib' t/
Subject: Dios-0.002012.patch
diff --git a/t/anon.t b/t/anon.t index 6ce011b..412ecca 100755 --- a/t/anon.t +++ b/t/anon.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More 'no_plan'; +use Test::More; { package Stuff; @@ -19,3 +19,6 @@ use Test::More 'no_plan'; is( Stuff->$method("foo"), "foo" ); } + +done_testing; + diff --git a/t/caller.t b/t/caller.t index f17bc62..758ddb1 100755 --- a/t/caller.t +++ b/t/caller.t @@ -3,7 +3,7 @@ { package Foo; - use Test::More 'no_plan'; + use Test::More; use Dios; diff --git a/t/default_on_missing.t b/t/default_on_missing.t index 2ade3d9..79e897c 100755 --- a/t/default_on_missing.t +++ b/t/default_on_missing.t @@ -1,7 +1,7 @@ use strict; use warnings; -use Test::More 'no_plan'; +use Test::More; { package Stuff; @@ -84,3 +84,6 @@ SKIP: { is( Bar->code(42), 44 ); } + +done_testing; + diff --git a/t/invocant.t b/t/invocant.t index 39deffc..c84c23c 100755 --- a/t/invocant.t +++ b/t/invocant.t @@ -4,7 +4,7 @@ use strict; use warnings; use Dios; -use Test::More 'no_plan'; +use Test::More; class Stuff { use Test::More; @@ -65,3 +65,6 @@ is( $stuff->no_invocant_class_type(Foo::Bar->new), 'Foo::Bar' ); is( $stuff->no_invocant_named_param(arg => Foo->new), 'Foo' ); is( $stuff->no_invocant_return(), 0 ); is( $stuff->no_invocant_named_return(), 0 ); + +done_testing; + diff --git a/t/method.t b/t/method.t index 1be063f..28a9911 100755 --- a/t/method.t +++ b/t/method.t @@ -1,5 +1,5 @@ use strict; -use Test::More 'no_plan'; +use Test::More; { package Foo; @@ -69,3 +69,6 @@ is_deeply [$obj->caller], [__PACKAGE__, $0, __LINE__], 'caller works'; is $obj->warn, "Testing warn at $0 line 42.\n"; is eval { $obj->strict }, 42; + +done_testing; + diff --git a/t/named_refs.t b/t/named_refs.t index 6c9d017..7dbe433 100755 --- a/t/named_refs.t +++ b/t/named_refs.t @@ -5,10 +5,6 @@ use lib 't/lib'; use Test::More; -BEGIN { - plan 'no_plan'; -} - # Test a basic alias. { package Foo; @@ -77,4 +73,5 @@ BEGIN { ::is_deeply [$closure2->()], [4,5,6]; } +done_testing; diff --git a/t/odd_number.t b/t/odd_number.t index d9d9aed..3e235ab 100755 --- a/t/odd_number.t +++ b/t/odd_number.t @@ -1,7 +1,7 @@ package Foo; use strict; -use Test::More 'no_plan'; +use Test::More; use Dios; @@ -11,3 +11,6 @@ method foo(:$name, :$value) { ok !eval{ Foo->foo(name => 42, value =>); } => 'Missing named argument value'; like $@, qr{No argument found for named parameter \:\$value} => 'Correct exception'; + +done_testing; + diff --git a/t/paren_on_own_line.t b/t/paren_on_own_line.t index 469dd40..d83cca0 100755 --- a/t/paren_on_own_line.t +++ b/t/paren_on_own_line.t @@ -4,7 +4,7 @@ use strict; use warnings; use Dios; -use Test::More 'no_plan'; +use Test::More; method foo( $arg @@ -15,3 +15,6 @@ method foo( is $@, ''; is( Foo->foo(42), 42 ); + +done_testing; + diff --git a/t/paren_plus_open_block.t b/t/paren_plus_open_block.t index 9774917..ec05d4a 100755 --- a/t/paren_plus_open_block.t +++ b/t/paren_plus_open_block.t @@ -3,7 +3,7 @@ use warnings; package Foo; -use Test::More "no_plan"; +use Test::More; use Dios; method foo( @@ -14,3 +14,6 @@ method foo( } is( Foo->foo(23), 23 ); + +done_testing; + diff --git a/t/perl_attrs.t b/t/perl_attrs.t index 2e6c560..353272b 100755 --- a/t/perl_attrs.t +++ b/t/perl_attrs.t @@ -2,7 +2,7 @@ use 5.014; use strict; use warnings; -use Test::More 'no_plan'; +use Test::More; use attributes; @@ -49,3 +49,6 @@ use attributes; ::ok($cb_called, 'attribute handler got called'); ::is_deeply($attrs, [qw/Bar Moo(:Ko{oh) Baz(fu{bar:)/], '... with the right attributes'); } + +done_testing; + diff --git a/t/refs.t b/t/refs.t index 0ccb0ce..c5652f3 100755 --- a/t/refs.t +++ b/t/refs.t @@ -5,10 +5,6 @@ use lib 't/lib'; use Test::More; -BEGIN { - plan 'no_plan'; -} - # Test a basic alias. { package Foo; @@ -80,3 +76,5 @@ BEGIN { ::is_deeply [$closure2->()], [4,5,6]; } +done_testing; +
Subject: Re: [rt.cpan.org #123015] Segmentation faults and bus errors
Date: Mon, 5 Nov 2018 08:54:49 +0000
To: bug-Dios [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Thank-you Felix. Great sleuthing and an excellent patch. Very much appreciated. Long-term it's looking like I'm going to have to back out the move to Variable::Magic and use tied variables instead. :-( That's now on my to-do list. Thanks again. Damian