fix: avoid crashing dragonfly on parsing error of cgroups config (#1503)

Fixes #1502

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2023-07-02 12:11:44 +03:00 committed by GitHub
parent 52192e0596
commit e71fae7eea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -512,7 +512,10 @@ error_code GetCGroupPath(string* memory_path, string* cpu_path) {
// in v1 the format is
// N:s1:2 where N is an integer, s1, s2 strings with s1 maybe empty.
vector<string_view> entry = absl::StrSplit(sv, ':');
CHECK_EQ(entry.size(), 3u);
if (entry.size() != 3u) {
LOG(ERROR) << "Unsupported group " << sv;
continue;
}
// in v1 there are several 'canonical' cgroups
// we are interested in the 'memory' and the 'cpu,cpuacct' ones