Bug 1875290

Summary: sealert "hangs" if setroubleshootd dies unexpectedly
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: setroubleshootAssignee: Vit Mojzis <vmojzis>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: low Docs Contact: Khushbu Borole <kborole>
Priority: low    
Version: 8.2CC: apeetham, jafiala, lvrabec, mmalik, plautrba, vmojzis
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
.Fixed `sealert` connection issue handling Previously, a crash of the `setroubleshoot` daemon could cause the `sealert` process to stop responding. Consequently, the GUI did not show any analysis and also became unresponsive, the command line tool did not print any output and kept running until killed. This update improves handling of connection issues between `sealert` and `setroubleshootd`. Now `sealert` reports an error message and exits in case the `setroubleshoot` daemon crashes.
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 16:11:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Renaud Métrich 2020-09-03 08:30:13 UTC
Description of problem:

If for some reason setroubleshootd dies and the connection has not be accepted yet (e.g. BZ #1871869), sealert waits forever and user must use ^C to bail out.


Version-Release number of selected component (if applicable):

setroubleshoot-server-3.3.22-2.el8.x86_64


How reproducible:

Always mimicing setroubleshootd dying


Steps to Reproduce:
1. Edit /usr/lib/python3.6/site-packas/setroubleshoot/rpc.py to exit before accepting the connection

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# diff -u /usr/lib/python3.6/site-packages/setroubleshoot/rpc.py.orig /usr/lib/python3.6/site-packas/setroubleshoot/rpc.py
--- /usr/lib/python3.6/site-packages/setroubleshoot/rpc.py.orig	2020-09-03 10:18:17.717679610 +0200
+++ /usr/lib/python3.6/site-packages/setroubleshoot/rpc.py	2020-09-03 10:18:45.670973694 +0200
@@ -703,6 +703,8 @@
 
             if io_condition & GLib.IO_IN:
                 try:
+                    import sys
+                    sys.exit(1)
                     client_socket, client_address = socket.accept()
                     fcntl.fcntl(client_socket.fileno(), fcntl.F_SETFD, fcntl.FD_CLOEXEC)
                     client_handler = self.client_connection_handler_class(self.socket_address)
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

2. Execute sealert

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# sealert -l \*
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Actual results:

Hangs

Expected results:

Exit after some time / upon detecting connection is dead

Comment 3 Vit Mojzis 2021-02-02 12:26:25 UTC
https://pagure.io/setroubleshoot/pull-request/51

Comment 14 errata-xmlrpc 2021-05-18 16:11:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (setroubleshoot bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1929