develooper Front page | perl.perl5.porters | Postings from May 2015

TONYC TPF Grant 5 report #3

Tony Cook
May 5, 2015 09:11
TONYC TPF Grant 5 report #3
Message ID:
[Hours]         [Activity]
2015/04/13      Monday
 0.17           #123998 start xp x64 box recovery for testing
 0.63           #124080 review and comment
 0.70           #123998 more recovery
 0.97           #124063 review, research, comment
 0.20           #122136 review cpan tickets and update (no changes found)
 0.07           #122251 review cpan tickets and update – patch for
 0.17           #122432 review cpan tickets and update (no updates)
 0.27           #123213 review cpan tickets and update (yatt* patched)

2015/04/14      Tuesday
 2.15           #124127 start bisect for issue mentioned by ntyni, review
                code, debugging
 1.87           #124127 debugging, comment with patch
 0.62           #124221 try to reproduce test issue, close

2015/04/15      Wednesday
 1.28           #124127 testing, comment, open new ticket (which I merge
                into #124203 later)
 0.52           #124300 review, test and comment
 0.43           #124303 review and test
 1.08           #124267 review, comment, testing
 1.97           #124203 review, merge ticket and comment, debugging, check
                older perls

2015/04/16      Thursday
 1.27           #124127 further testing, push to blead, close
 1.63           #123879 debugging
 2.48           #123879 debugging, find cause, open cpan module tickets,

Which I calculate is 18.48 hours.

Approximately 14 tickets were reviewed or worked on.

[perl #124127] taught me some more about how arrays are implemented in
perl.  In particular, when perl allocates its SV * array elements that
are allocated but not yet used are initialized immediately, rather
than when they are needed.  This simplifies extending an array since
perl doesn't need to go through an initialize those elements.

In the case of this bug, Father Chrysostomos changed the value used
for unused array elements from &PL_sv_undef to NULL, but missed
updating the S_sv_dup_common(), which is called to duplicate SVs of
all types when the perl interpreter is cloned.

This then produced "Modification of a read-only value attempted"
errors when the user extended the array and then attemptted to modify
one of the new elements.

[perl #123879] is a case of a change to perl revealing a bug in CPAN

The bug revealed itself as an error deep in
DBIx::Class::Storage::DBI::SQLite, where perl complained that the 0 in
the range:

  for my $i (0.. $#$bindattrs) {

was outside the integer range.  After some debugging it turned out the
floating point register stack was overflowing, and when the zero was
pushing onto the stack it became pushed as a NaN, causing
pp_enteriter() to complain.

So how to find the overflow?  This could be caused by either bad
generated code or by some other cause, unknown to me at the time.

I ended up modifying Perl_runops_debug() to check that the floating
point stack was zero after each op, and to dump some information
before asserting:

--- a/dump.c
+++ b/dump.c
@@ -2200,6 +2200,7 @@ Perl_sv_dump(pTHX_ SV *sv)
+    OP *oldop = NULL;
     if (!PL_op) {
        Perl_ck_warner_d(aTHX_ packWARN(WARN_DEBUGGING), "NULL OP IN RUN");
        return 0;
@@ -2207,9 +2208,17 @@ Perl_runops_debug(pTHX)
     DEBUG_l(Perl_deb(aTHX_ "Entering new RUNOPS level\n"));
     do {
+        unsigned short sw;
+        __asm__ ( "fstsw %0" : "=m" (sw) );
+        /*PerlIO_printf(PerlIO_stderr(), "sw %x\n", sw);*/
+        if (sw & 0x3840) {
+            Perl_warner(aTHX_ 0, "oldop %p sw %x", (void *)oldop, sw);
+        }
+        assert((sw & 0x40) == 0);
+        assert((sw & 0x3800) == 0);
        if (PL_debug) {
            if (PL_watchaddr && (*PL_watchaddr != PL_watchok))
@@ -2230,6 +2239,7 @@ Perl_runops_debug(pTHX)
            if (DEBUG_P_TEST_) debprof(PL_op);
+        oldop = PL_op;
     } while ((PL_op = PL_op->op_ppaddr(aTHX)));
     DEBUG_l(Perl_deb(aTHX_ "leaving RUNOPS level\n"));

This asserted at the call to install_time_api() in Time::Warp, which
DBIx::Class::TimeStamp uses for testing.

Investigation from there led me to filing:

which Gábor quickly applied as released at Time-Warp 0.52. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About