Skip to content

Commit

Permalink
Avoid printing stacktrace when cgroup configuration fails
Browse files Browse the repository at this point in the history
* Printing a stacktrace here interferes with the test output parsing of the
  fullstack test because lines like `ok 66 - …` can be meddled into the
  stacktrace (see
  #4136 (comment))
* It fails in many setups and that's known and nothing we need to show a
  stracktrace for.
* Avoid empty blank line in logs

# Conflicts:
#	dist/rpm/openQA.spec
  • Loading branch information
Martchus committed Aug 25, 2021
1 parent 2ef2694 commit 98e9f63
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/ci-packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ perl-B-Hooks-OP-Check-0.22
perl-B-Keywords-1.18
perl-BSD-Resource-1.2911
perl-Capture-Tiny-0.46
perl-Carp-Always-0.13
perl-Carp-Always-0.16
perl-Carp-Clan-6.06
perl-Class-Accessor-0.51
perl-Class-Accessor-Chained-0.01
Expand Down
2 changes: 1 addition & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ requires 'BSD::Resource';
requires 'CSS::Minifier::XS', '>= 0.01';
requires 'Capture::Tiny';
requires 'Carp';
requires 'Carp::Always';
requires 'Carp::Always', '>= 0.14.02';
requires 'CommonMark';
requires 'Config::IniFiles';
requires 'Config::Tiny';
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build_requires:
common_requires:
perl: '>= 5.20.0'
perl(Archive::Extract): '> 0.7'
perl(Carp::Always):
perl(Carp::Always): '>= 0.14.02'
perl(Config::IniFiles):
perl(Cpanel::JSON::XS): '>= 4.09'
perl(Cwd):
Expand Down
2 changes: 1 addition & 1 deletion dist/rpm/openQA.spec
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
# The following line is generated from dependencies.yaml
%define assetpack_requires perl(CSS::Minifier::XS) >= 0.01 perl(JavaScript::Minifier::XS) >= 0.11 perl(Mojolicious::Plugin::AssetPack) >= 1.36
# The following line is generated from dependencies.yaml
%define common_requires perl >= 5.20.0 perl(Archive::Extract) > 0.7 perl(Carp::Always) perl(Config::IniFiles) perl(Cpanel::JSON::XS) >= 4.09 perl(Cwd) perl(Data::Dump) perl(Data::Dumper) perl(Digest::MD5) perl(Filesys::Df) perl(Getopt::Long) perl(Minion) >= 10.22 perl(Mojolicious) >= 9.11 perl(Regexp::Common) perl(Storable) perl(Try::Tiny)
%define common_requires perl >= 5.20.0 perl(Archive::Extract) > 0.7 perl(Carp::Always) >= 0.14.02 perl(Config::IniFiles) perl(Cpanel::JSON::XS) >= 4.09 perl(Cwd) perl(Data::Dump) perl(Data::Dumper) perl(Digest::MD5) perl(Filesys::Df) perl(Getopt::Long) perl(Minion) >= 10.22 perl(Mojolicious) >= 9.11 perl(Regexp::Common) perl(Storable) perl(Try::Tiny)
# runtime requirements for the main package that are not required by other sub-packages
# The following line is generated from dependencies.yaml
%define main_requires %assetpack_requires git-core hostname perl(BSD::Resource) perl(Carp) perl(CommonMark) perl(Config::Tiny) perl(DBD::Pg) >= 3.7.4 perl(DBI) >= 1.632 perl(DBIx::Class) >= 0.082801 perl(DBIx::Class::DeploymentHandler) perl(DBIx::Class::DynamicDefault) perl(DBIx::Class::OptimisticLocking) perl(DBIx::Class::ResultClass::HashRefInflator) perl(DBIx::Class::Schema::Config) perl(DBIx::Class::Storage::Statistics) perl(Date::Format) perl(DateTime) perl(DateTime::Duration) perl(DateTime::Format::Pg) perl(Exporter) perl(Fcntl) perl(File::Basename) perl(File::Copy) perl(File::Copy::Recursive) perl(File::Path) perl(File::Spec) perl(FindBin) perl(Getopt::Long::Descriptive) perl(IO::Handle) perl(IPC::Run) perl(JSON::Validator) perl(LWP::UserAgent) perl(Module::Load::Conditional) perl(Module::Pluggable) perl(Mojo::Base) perl(Mojo::ByteStream) perl(Mojo::IOLoop) perl(Mojo::JSON) perl(Mojo::Pg) perl(Mojo::RabbitMQ::Client) >= 0.2 perl(Mojo::URL) perl(Mojo::Util) perl(Mojolicious::Commands) perl(Mojolicious::Plugin) perl(Mojolicious::Static) perl(Net::OpenID::Consumer) perl(POSIX) perl(Pod::POM) perl(SQL::Translator) perl(Scalar::Util) perl(Sort::Versions) perl(Text::Diff) perl(Time::HiRes) perl(Time::ParseDate) perl(Time::Piece) perl(Time::Seconds) perl(URI::Escape) perl(YAML::PP) >= 0.026 perl(YAML::XS) perl(aliased) perl(base) perl(constant) perl(diagnostics) perl(strict) perl(warnings)
Expand Down
9 changes: 8 additions & 1 deletion lib/OpenQA/Worker/Engines/isotovideo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ use OpenQA::CacheService::Client;
use OpenQA::CacheService::Request;
use Time::HiRes 'sleep';
use IO::Handle;
use Module::Loaded 'is_loaded';
use Mojo::IOLoop::ReadWriteProcess 'process';
use Mojo::IOLoop::ReadWriteProcess::Session 'session';
use Mojo::IOLoop::ReadWriteProcess::Container 'container';
use Mojo::IOLoop::ReadWriteProcess::CGroup 'cgroupv2';
use Mojo::Collection 'c';
use Mojo::File 'path';
use Mojo::Util 'trim';
use Mojo::Util qw(trim scope_guard);

use constant CGROUP_SLICE => $ENV{OPENQA_CGROUP_SLICE};
use constant CACHE_SERVICE_POLL_DELAY => $ENV{OPENQA_CACHE_SERVICE_POLL_DELAY} // 5;
Expand Down Expand Up @@ -359,6 +360,11 @@ sub engine_workit ($job, $callback) {
sub _configure_cgroupv2 ($job_info) {
# create cgroup within /sys/fs/cgroup/systemd
log_info('Preparing cgroup to start isotovideo');
my $carp_guard;
if (is_loaded('Carp::Always')) {
$carp_guard = scope_guard sub { Carp::Always->import }; # uncoverable statement
Carp::Always->unimport; # uncoverable statement
}
my $cgroup_name = 'systemd';
my $cgroup_slice = CGROUP_SLICE;
if (!defined $cgroup_slice) {
Expand All @@ -379,6 +385,7 @@ sub _configure_cgroupv2 ($job_info) {
};
if (my $error = $@) {
$cgroup = c();
chomp $error;
log_warning("Disabling cgroup usage because cgroup creation failed: $error");
log_info(
'You can define a custom slice with OPENQA_CGROUP_SLICE or indicating the base mount with MOJO_CGROUP_FS.');
Expand Down

0 comments on commit 98e9f63

Please sign in to comment.