https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6937

            Bug ID: 6937
           Summary: 3.3.2 and Perl 5.18.0:  Altering hash requires
                    restarting loop else UNDEFINED behavior.
           Product: Spamassassin
           Version: 3.3 SVN branch
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: spamassassin
          Assignee: dev@spamassassin.apache.org
          Reporter: software+spamassas...@kd6lvw.ampr.org

Error in syslog:  Use of each() on hash after insertion without resetting hash
iterator results in undefined behavior at
/usr/local/lib/perl5/site_perl/5.18.0/Mail/SpamAssassin/AsyncLoop.pm line 363.

(SpamAssassin 3.3.2 installed.)

Code (starting at line 363 - a while loop):

    while (my($key,$ent) = each %$pending) {
      my $id = $ent->{id};
      if (defined $ent->{poll_callback}) {  # call a "poll_callback" if exists
        # be nice, provide fresh info to a callback routine
        $ent->{status} = 'FINISHED'  if exists $self->{finished}->{$id};
        # a callback might call set_response_packet() or report_id_complete()
      # dbg("async: calling poll_callback on key $key");
        $ent->{poll_callback}->($ent);
      }
      my $finished = exists $self->{finished}->{$id};
      if ($finished) {
        $anydone = 1;
        delete $self->{finished}->{$id};
        $ent->{status} = 'FINISHED';
        $ent->{finish_time} = $now  if !defined $ent->{finish_time};
        my $elapsed = $ent->{finish_time} - $ent->{start_time};
        dbg("async: completed in %.3f s: %s", $elapsed, $ent->{display_id});

        # call a "completed_callback" sub, if one exists
        if (defined $ent->{completed_callback}) {
        # dbg("async: calling completed_callback on key $key");
          $ent->{completed_callback}->($ent);
        }
        $self->{timing_by_query}->{". $key"} += $elapsed;
        $self->{queries_completed}++;
        $self->{total_queries_completed}++;
        delete $pending->{$key};
      }
    }

This is beyond my ability to suggest a fix.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to