develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134172] commit 027471cf breaks t/op/sprintf2.t on FreeBSD-11

Thread Previous | Thread Next
From:
James E Keenan via RT
Date:
June 5, 2019 13:32
Subject:
[perl #134172] commit 027471cf breaks t/op/sprintf2.t on FreeBSD-11
Message ID:
rt-4.0.24-9375-1559741533-868.134172-15-0@perl.org
On Wed, 05 Jun 2019 13:22:36 GMT, hv wrote:
> On Wed, 05 Jun 2019 05:39:11 -0700, jkeenan wrote:
> > (The previously reported backtrace was from a version of
> > t/op/sprintf2.t with all tests but the final one commented out.)
> 
> Ah ok; since the first one-liner is enough to reproduce the crash, I
> suggest sticking with that for further testing:
>   ./perl -e 'my $x = sprintf("%7000000000E", 0)'
> 
> [...]
> > #16 0x000000000044c596 in Perl_sys_term () at perl.c:152
> > #17 0x0000000000421472 in main (argc=<value optimized out>,
> > argv=<value optimized out>, env=0x7fffffffe758)
> >     at perlmain.c:155
> 
> That looks like it is in the line:
>         LOCALE_TERM;                /* PL_locale_mutex */
> .. and since this is one of the mutex destroy calls that happens
> _after_ we've torn down the perlio system it's no surprise that
> attempting to croak() goes badly.
> 
> From here I'll need some help: I'm not sure how to refer to the
> location of this mutex for a threaded build in gdb - I was expecting
> it to be something like 'my_vars->Glocale_mutex', but at least on my
> local build that's not recognised.
> 
> If someone can tell us that, the next step will be to run the test in
> gdb with a hardware watchpoint on the mutex. That'll look something
> like this:
> 
> shell% gdb --args ./perl -e 'my $x = sprintf("%7000000000E", 0)'
> (gdb) # first let the interpreter initialise
> (gdb) tbreak perlmain.c:126
> (gdb) run
>  Temporary breakpoint 1, main (argc=<optimized out>, argv=<optimized
> out>,
>     env=<optimized out>) at perlmain.c:126
> 126         if (!perl_parse(my_perl, xs_init, argc, argv, (char
> **)NULL))
> (gdb) watch PL_locale_mutex # replace with appropriate expression to
> refer to this mutex
> (gdb) run
> 
> Hopefully that would then stop somewhere other than in the
> MUTEX_DESTROY, and a stack trace will show us where and how the
> corruption is occurring.
> 
> Hugo

I'm not sure whether you wanted *me* to run the above commands prior to hearing from someone about mutexes, but, for what it's worth, here's what I got:

#####
[perl] $ gdb --args ./perl -e 'my $x = sprintf("%7000000000E", 0)'
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) 
(gdb) tbreak perlmain.c:126
Breakpoint 1 at 0x4213d6: file perlmain.c, line 126.
(gdb) run
Starting program: /usr/home/jkeenan/gitwork/perl/perl -e my\ \$x\ =\ sprintf\(\"%7000000000E\",\ 0\)
main (argc=3, argv=0x7fffffffe770, env=0x7fffffffe790) at perlmain.c:126
126	    if (!perl_parse(my_perl, xs_init, argc, argv, (char **)NULL))
(gdb) watch PL_locale_mutex
Watchpoint 2: PL_locale_mutex
(gdb) run
The program being debugged has been started already.
Start it from the beginning? (y or n) y

Starting program: /usr/home/jkeenan/gitwork/perl/perl -e my\ \$x\ =\ sprintf\(\"%7000000000E\",\ 0\)
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex
Watchpoint 2: PL_locale_mutex

Old value = 0x0
New value = 0x801e1c1e0
0x0000000800c6caec in __pthread_mutex_init (mutex=0xa45b28, mutex_attr=<value optimized out>) at pthread_md.h:94
94	{
Current language:  auto; currently minimal
(gdb) bt
#0  0x0000000800c6caec in __pthread_mutex_init (mutex=0xa45b28, mutex_attr=<value optimized out>)
    at pthread_md.h:94
#1  0x000000000044c702 in perl_alloc () at perl.c:97
#2  0x00000000004213a9 in main (argc=3, argv=0x7fffffffe770, env=0x7fffffffe790) at perlmain.c:119
(gdb) 
#####

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134172

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About