action #44240

Fix flaky t/25-cache-service.t

Added by mkittler over 1 year ago. Updated 11 months ago.

Status:ResolvedStart date:22/11/2018
Priority:LowDue date:
Assignee:-% Done:

0%

Category:-
Target version:Current Sprint
Difficulty:
Duration:

Description

I have seen this error already multiple times on Travis:

<7>[1373] [d] Requested [cache_asset] Args: 922756 hdd sle-12-SP3-x86_64-0368-200_133333@64bit.qcow2 http://localhost:45903 Lock: 95ddfaaa4a11e71a72b8751d1c07ebe3.sle-12-SP3-x86_64-0368-200_133333@64bit.qcow2.http://localhost:45903
<7>[1373] [d] 200 OK (0.002608s, 383.436/s)
    # No tests run!
#   Failed test 'No tests run for subtest "Test Minion task registration and execution"'
#   at ./t/25-cache-service.t line 447.
<7>[1374] [d] Process 1481 is performing job "36" with task "cache_asset"
Can't call method "execute" on an undefined value at ./t/25-cache-service.t
    line 442 (#1)
    (F) You used the syntax of a method call, but the slot filled by the
    object reference or package name contains an undefined value.  Something
    like this will reproduce the error:

        $BADREF = undef;
        process $BADREF 1,2,3;
        $BADREF->process(1,2,3);

Uncaught exception from user code:
    Can't call method "execute" on an undefined value at ./t/25-cache-service.t line 442.
    Test::Builder::subtest('Test::Builder=HASH(0x5930ff0)', 'Test Minion task registration and execution', 'CODE(0xcb8f0e8)') called at /usr/lib/perl5/vendor_perl/5.18.2/Test/More.pm line 807
    Test::More::subtest('Test Minion task registration and execution', 'CODE(0xcb8f0e8)') called at ./t/25-cache-service.t line 447

History

#1 Updated by mkittler over 1 year ago

  • Status changed from New to In Progress

The dequeue call in the line 442 returns undef if there's no worker ID or $minion->backend->dequeue returns undef:

sub dequeue {
  my ($self, $wait, $options) = @_;

  # Worker not registered
  return undef unless my $id = $self->id;

  my $minion = $self->minion;
  return undef unless my $job = $minion->backend->dequeue($id, $wait, $options);
  $job = Minion::Job->new(
    args    => $job->{args},
    id      => $job->{id},
    minion  => $minion,
    retries => $job->{retries},
    task    => $job->{task}
  );
  $self->emit(dequeue => $job);
  return $job;
}

PR to further debug the test: https://github.com/os-autoinst/openQA/pull/1889

#2 Updated by mkittler about 1 year ago

After merging the PR, it looks like this:

    #   Failed test 'job enqueued'
    #   at ./t/25-cache-service.t line 442.
    # Looks like you failed 1 test of 2.
#   Failed test 'Test Minion task registration and execution'
#   at ./t/25-cache-service.t line 448.
Can't call method "execute" on an undefined value at ./t/25-cache-service.t line 443.

So the worker ID is set. Hence it must be either $minion->backend->dequeue(...) or Minion::Job->new(...) which returns undef.

#3 Updated by kraih about 1 year ago

The call to Minion::Job->new(...) can't return undef.

#4 Updated by mkittler about 1 year ago

Which only leaves one path to follow :-)

#5 Updated by mkittler about 1 year ago

  • Priority changed from Normal to Low

I haven't seen this failure for quite a while now. In fact not once since I've added the extra checks for debugging.

#6 Updated by mkittler 11 months ago

  • Status changed from In Progress to Resolved

Since it is not happening anymore (at least I'm not aware) I mark this as resolved.

Also available in: Atom PDF