Skip to content

perf test: Handle fd gaps in test__dso_data_reopen

Michael Petlan requested to merge mpetlan/centos-stream-9:my_bz1937209 into main

Bugzilla: https://bugzilla.redhat.com/1937209

upstream

commit 880569296fb8989516be0492eb304cb88c879e5c
Author: Eirik Fuller efuller@redhat.com
Date: Fri Jun 25 22:38:25 2021 -0400

description

https://github.com/beaker-project/restraint/issues/215 describes a file
descriptor leak which revealed the test failure described here.

The 'DSO data reopen' perf test assumes that RLIMIT_NOFILE limits the
number of open file descriptors, but it actually limits newly opened
file descriptors. When the file descriptor limit is reduced, file
descriptors already open remain open regardless of the new limit. This
test failure does not occur if open file descriptors are contiguous,
beginning at zero.

The following command triggers this perf test failure.

perf test 'DSO data reopen' 3>/dev/null 8>/dev/null

This patch determines the file descriptor limit by opening four files
and then closing them. The limit is set to the fourth file descriptor,
leaving only the first three available because any newly opened file
descriptor must be less than the limit.

LPU-Reference: 20210626023825.1398547-1-efuller@redhat.com

Signed-off-by: Michael Petlan mpetlan@redhat.com

Edited by Prarit Bhargava

Merge request reports