Project

General

Profile

Actions

action #108662

closed

coordination #109668: [saga][epic] Stable and updated non-qemu backends for SLE validation

coordination #109656: [epic] Stable non-qemu backends

coordination #105699: [epic] 5 whys follow-up to s390x svirt jobs incomplete with unable to extract assets:.*/var/lib/libvirt/images/a.img" size:S

Can't call method "id" on an undefined value at WebAPI/Controller/Test.pm

Added by livdywan over 2 years ago. Updated over 2 years ago.

Status:
Resolved
Priority:
High
Assignee:
Category:
Regressions/Crashes
Target version:
Start date:
2021-12-29
Due date:
% Done:

0%

Estimated time:

Description

Observation

As seen several times via openQA logreport this morning:

[2022-03-21T11:21:14.461186Z] [error] [IDnMofhwCJm4] Can't call method "id" on an undefined value at /usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/Test.pm line 432.
[2022-03-21T11:23:01.929670Z] [error] [-lOdaq2Bg8bJ] Can't call method "id" on an undefined value at /usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/Test.pm line 432.

Acceptance criteria

  • AC1:

Suggestions


Related issues 1 (0 open1 closed)

Copied from openQA Infrastructure (public) - action #108401: Can't call method "id" on an undefined value at V1/Job.pmResolvedtinita2021-12-29

Actions
Actions #1

Updated by livdywan over 2 years ago

  • Copied from action #108401: Can't call method "id" on an undefined value at V1/Job.pm added
Actions #2

Updated by okurz over 2 years ago

  • Project changed from openQA Infrastructure (public) to openQA Project (public)
  • Category set to Regressions/Crashes
  • Priority changed from Normal to High
Actions #3

Updated by livdywan over 2 years ago

[2022-03-21T23:29:26.498127Z] [error] [UB5uD6L4qCvY] Can't call method "id" on an undefined value at /usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/Test.pm line 432.
Actions #4

Updated by okurz over 2 years ago

  • Due date set to 2022-04-05
  • Status changed from New to In Progress
  • Assignee set to okurz

code looks like this

430 sub job_next_previous_ajax ($self) {   
431     my $main_job = $self->get_current_job;
432     my $main_jobid = $main_job->id;

and the method get_current_job looks like this:

397 sub get_current_job ($self, $with_assets = 0) {
398     return $self->reply->not_found unless defined $self->param('testid');
399 
400     my $job = $self->schema->resultset("Jobs")
401       ->find($self->param('testid'), {$with_assets ? (prefetch => qw(jobs_assets)) : ()});
402     return $job;
403 }

IMHO a classical problem of one shouldn't use external facing functions internally. So get_current_job does not ensure to always yield a valid job. A suboptimal solution would be to check for the validity of the returned object before trying to access its id.

https://github.com/os-autoinst/openQA/pull/4574 should do that

But likely cleaner would be if we can avoid the explicit value checking with exceptions.

Actions #5

Updated by okurz over 2 years ago

  • Status changed from In Progress to Feedback

https://github.com/os-autoinst/openQA/pull/4574 merged and deployed on o3. grep 'Can.* call method.*id' /var/log/openqa does not return anything anymore. https://github.com/os-autoinst/openQA/pull/4575 is a followup with a discussion going on.

Actions #6

Updated by okurz over 2 years ago

  • Due date deleted (2022-04-05)
  • Status changed from Feedback to Resolved

https://github.com/os-autoinst/openQA/pull/4574 is merged and effective, no more problems observed. Optionally, eventually we can continue with https://github.com/os-autoinst/openQA/pull/4575

Actions

Also available in: Atom PDF