Bug 1822100
| Summary: | semanage loses sys.stderr | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | debugitu <RedHat-Bug> |
| Component: | policycoreutils | Assignee: | Vit Mojzis <vmojzis> |
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 8.4 | CC: | dwalsh, lvrabec, mmalik, plautrba, ssekidde, vmojzis |
| Target Milestone: | rc | Keywords: | Triaged |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | No Doc Update | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2021-05-18 15:09:18 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
debugitu
2020-04-08 09:12:08 UTC
Sorry, it is not local customization related. If I simply do: semanage fcontext -l | egrep -s -q -e '^/home ' I got the same error: close failed in file object destructor: sys.excepthook is missing lost sys.stderr It is probably just a race condition on exit. Isn't the error caused by the grep process which terminates sooner than the semanage process? The kernel sends a 'SIGPIPE' (13) signal to the active semanage process. The semanage process sometimes correctly gives the error message: IOError: [Errno 32] Broken pipe Sometimes incorrectly outputs: close failed in file object destructor: sys.excepthook is missing lost sys.stderr This issue was not selected to be included in Red Hat Enterprise Linux 7 because it is seen either as low or moderate impact to a small number of use-cases. Current minor release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. Moving the request to Red Hat Enterprise Linux 8 product. The problem seems to be described in Python's documentation - https://docs.python.org/3/library/signal.html#note-on-sigpipe I wasn't able to reproduce the issue on RHEL 7.8, RHEL 8.3 or Fedora 34. The only issue I'm seeing is occasional double reporting of the "BrokenPipeError" (and "Exception ignored" warning): #semanage fcontext -l | egrep -q -e '^/home' BrokenPipeError: [Errno 32] Broken pipe Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'> BrokenPipeError: [Errno 32] Broken pipe which is caused by python flushing output on exit (as described in Comment 6). I submitted a patch to upstream fixing this. Are you still able to reproduce the behaviour you originally reported? If so, please share your python and policycoreutils-python(-utils) package versions or any additional steps that may help reproduce it. I do not have 7.8 release any more, all are upgraded to 7.9. I cannot see the reported error on 7.9. I never tried on major release 8. Before, the specific error was very stable, it always came. It did not seem to be a race condition, however that cannot be excluded. If the code of the policycoreutils-python kit did not change from 7.8 to 7.9, may be the code of some underlying python library? (In reply to debugitu from comment #12) > I do not have 7.8 release any more, all are upgraded to 7.9. > I cannot see the reported error on 7.9. > I never tried on major release 8. > > Before, the specific error was very stable, it always came. It did not seem > to be a race condition, however that cannot be excluded. > > If the code of the policycoreutils-python kit did not change from 7.8 to > 7.9, may be the code of some underlying python library? Thank you. I was thinking the same thing (change in some python I/O library). Anyway, this is the patch (I'll merge it as soon as upstream accepts it): https://lore.kernel.org/selinux/CAJfZ7==efgpSLs-U81UEp-0ven0mr3WZMLpP1+1XC8a-ww0uSg@mail.gmail.com/T/#t 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 (policycoreutils 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:1715 |