Skip to content

Commit

Permalink
Fix BZ#2071058 (#3375)
Browse files Browse the repository at this point in the history
Due to application workload or misbehavior the semaphores count might increase
significantly. Additionally, the current rules expects semids from selected
owners namely 'root', 'apache', and 'oracle'.

Closes-Bug: #2071058

Signed-off-by: Sachin Patil <[email protected]>
(cherry picked from commit 4546cc5)
  • Loading branch information
Sachin authored and xiangce committed Apr 7, 2022
1 parent 2fef78a commit d1c4e50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion insights/specs/datasources/ipcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ def semid(broker):
Returns:
list: A list of the semid of all the inter-processes.
"""
allowed_owners = ['root', 'apache', 'oracle']
content = broker[Specs.ipcs_s].content
results = set()
for s in content:
s_splits = s.split()
# key semid owner perms nsems
# 0x00000000 65536 apache 600 1
if len(s_splits) == 5 and s_splits[1].isdigit():
if len(s_splits) == 5 and s_splits[1].isdigit() and s_splits[2] in allowed_owners:
results.add(s_splits[1])
if results:
return list(results)
Expand Down
6 changes: 5 additions & 1 deletion insights/tests/datasources/test_ipcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
key semid owner perms nsems
0x00000000 65570 apache 600 1
0x00000000 98353 apache 600 1
0x00000000 28 fxadmin 0 1
0x0052e2c1 89998 oracle 600 26
0x00000000 98354 apache 600 1
0x00000000 98355 apache 600 1
0x00000000 98356 apache 600 1
Expand All @@ -34,7 +36,9 @@ def test_semid():
assert isinstance(result, list)
assert '65570' in result
assert '98357' in result
assert len(result) == 6
assert '89998' in result
assert '28' not in result
assert len(result) == 7


def test_exception():
Expand Down

0 comments on commit d1c4e50

Please sign in to comment.