Project

General

Profile

action #179395

Updated by okurz 7 days ago

## Observation 

 We received an e-mail from logwarn about the following errors: 

 ``` 
 [2025-03-24T08:27:26.368740Z] [error] [kLs_wpYg_yOq] Can't call method "taskname" on an undefined value at template test/infopanel.html.ep line 49. 
 Context: 
   44:                           Result: <b><%= $job->result %></b>\ 
   45:                       % } 
   46:                       % else { 
   47:                           % my $state_detail = ''; 
   48:                           % if (my @gru_deps = $job->gru_dependencies) { 
   49:                               % $state_detail = join(';', map { 'id: ' . $_->gru_task_id . ', name: ' . $_->gru_task->taskname } @gru_deps); 
   50:                               % $state_detail = ", waiting for background tasks ($state_detail)"; 
   51:                           % } 
   52:                           State: <b><%= $job->state %></b><%= $state_detail %>\ 
   53:                       % } 
   54:                       % if ($job->t_finished) { 
 Traceback (most recent call first): 
   File "template test/infopanel.html.ep", line 49, in "Mojo::Template::__ANON__"  
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Template.pm", line 160, in "Mojo::Template::Sandbox::7a37089bd1a269805599a44c68a7523a::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Template.pm", line 160, in "(eval)" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/EPLRenderer.pm", line 18, in "Mojo::Template::process" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/EPRenderer.pm", line 39, in "Mojolicious::Plugin::EPLRenderer::_render" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Renderer.pm", line 229, in "Mojolicious::Plugin::EPRenderer::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Renderer.pm", line 108, in "Mojolicious::Renderer::_render_template" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Controller.pm", line 182, in "Mojolicious::Renderer::render" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Controller.pm", line 196, in "Mojolicious::Controller::render" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/DefaultHelpers.pm", line 42, in "Mojolicious::Controller::render_to_string" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/EPRenderer.pm", line 48, in "Mojolicious::Plugin::DefaultHelpers::__ANON__" 
   File "template test/result.html.ep", line 31, in "Mojo::Template::Sandbox::7a37089bd1a269805599a44c68a7523a::include" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Template.pm", line 160, in "Mojo::Template::Sandbox::7a37089bd1a269805599a44c68a7523a::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Template.pm", line 160, in "(eval)" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/EPLRenderer.pm", line 18, in "Mojo::Template::process" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugin/EPRenderer.pm", line 39, in "Mojolicious::Plugin::EPLRenderer::_render" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Renderer.pm", line 229, in "Mojolicious::Plugin::EPRenderer::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Renderer.pm", line 108, in "Mojolicious::Renderer::_render_template" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Controller.pm", line 182, in "Mojolicious::Renderer::render" 
   File "/usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/Test.pm", line 559, in "Mojolicious::Controller::render" 
   File "/usr/share/openqa/script/../lib/OpenQA/WebAPI/Controller/Test.pm", line 538, in "OpenQA::WebAPI::Controller::Test::_show" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 193, in "OpenQA::WebAPI::Controller::Test::show"  
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugins.pm", line 15, in "Mojolicious::_action" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugins.pm", line 18, in "Mojolicious::Plugins::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Routes.pm", line 88, in "Mojolicious::Plugins::emit_chain" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Routes.pm", line 161, in "Mojolicious::Routes::_action" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Routes.pm", line 44, in "Mojolicious::Routes::_controller" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Routes.pm", line 46, in "Mojolicious::Routes::continue" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Routes.pm", line 52, in "Mojolicious::Routes::continue" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 127, in "Mojolicious::Routes::dispatch" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 136, in "Mojolicious::dispatch" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugins.pm", line 15, in "Mojolicious::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 203, in "Mojolicious::Plugins::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 203, in "(eval)" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugins.pm", line 15, in "Mojolicious::_exception" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Plugins.pm", line 18, in "Mojolicious::Plugins::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 141, in "Mojolicious::Plugins::emit_chain" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server.pm", line 72, in "Mojolicious::handler" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/EventEmitter.pm", line 15, in "Mojo::Server::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Daemon.pm", line 103, in "Mojo::EventEmitter::emit" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/EventEmitter.pm", line 15, in "Mojo::Server::Daemon::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Transaction/HTTP.pm", line 60, in "Mojo::EventEmitter::emit" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Daemon.pm", line 224, in "Mojo::Transaction::HTTP::server_read" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Daemon.pm", line 202, in "Mojo::Server::Daemon::_read" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/EventEmitter.pm", line 15, in "Mojo::Server::Daemon::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/IOLoop/Stream.pm", line 109, in "Mojo::EventEmitter::emit" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/IOLoop/Stream.pm", line 57, in "Mojo::IOLoop::Stream::_read" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Reactor/Poll.pm", line 141, in "Mojo::IOLoop::Stream::__ANON__" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Reactor/Poll.pm", line 141, in "(eval)" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Reactor/Poll.pm", line 60, in "Mojo::Reactor::Poll::_try" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Reactor/Poll.pm", line 101, in "Mojo::Reactor::Poll::one_tick" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/IOLoop.pm", line 134, in "Mojo::Reactor::Poll::start" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Prefork.pm", line 152, in "Mojo::IOLoop::start" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Prefork.pm", line 93, in "Mojo::Server::Prefork::_spawn" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojo/Server/Prefork.pm", line 78, in "Mojo::Server::Prefork::_manage" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Command/prefork.pm", line 38, in "Mojo::Server::Prefork::run" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious/Commands.pm", line 57, in "Mojolicious::Command::prefork::run" 
   File "/usr/lib/perl5/vendor_perl/5.26.1/Mojolicious.pm", line 184, in "Mojolicious::Commands::run" 
   File "/usr/share/openqa/script/../lib/OpenQA/WebAPI.pm", line 521, in "Mojolicious::start" 
   File "/usr/share/openqa/script/openqa", line 23, in "OpenQA::WebAPI::run" 
 ``` 

 ## Acceptance Criteria 
 * **AC1:** OpenQA job page does not result in a server error even if there is no gru_task for a gru_dependencies entry in the database 
 * **AC2:** gru_dependencies is ensured to only have entries for still existing corresponding gru_task entries 

 ## Suggestions 
 * The state where the job id had an entry in gru_dependencies but not in gru_task anymore lasted only for a moment. Currently the job is not in the gru_dependencies table anymore 

 ## Example 
 ``` 
 openqa=> select * from gru_dependencies limit 1; 
  job_id    | gru_task_id  
 ---------+------------- 
  4873132 |      21055332 
 (1 row) 

 openqa=> select * from gru_tasks where id=21055332; 
     id      | taskname    |                                                                   args                                                                   |         run_at          | priority |        t_created     
   |        t_updated       
 ----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------+---------------------+----------+------------------- 
 --+--------------------- 
  21055332 | git_clone | [{"\/var\/lib\/openqa\/share\/tests\/opensuse":null,"\/var\/lib\/openqa\/share\/tests\/opensuse\/products\/opensuse\/needles":null}] | 2025-02-21 13:10:59 |         10 | 2025-02-21 13:10:5 
 9 | 2025-02-21 13:10:59 
 (1 row) 
 ```

Back