Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2012859

Summary: unhandled exception when plugin timeout happens during logging a collected file
Product: Red Hat Enterprise Linux 9 Reporter: Pavel Moravec <pmoravec>
Component: sosAssignee: Pavel Moravec <pmoravec>
Status: CLOSED ERRATA QA Contact: Radek Duda <rduda>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: agk, bmr, mhradile, plambri, rduda, sbradley, theute, upgrades-and-supportability
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: ppc64le   
OS: Linux   
Whiteboard:
Fixed In Version: sos-4.2-4.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 2012857 Environment:
Last Closed: 2022-05-17 15:51:43 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:
Bug Depends On: 2012857    
Bug Blocks:    

Description Pavel Moravec 2021-10-11 13:26:05 UTC
+++ This bug was initially created as a clone of Bug #2012857 +++

Description of problem:
Spin-off from https://bugzilla.redhat.com/show_bug.cgi?id=1869561#c19 / https://bugzilla.redhat.com/show_bug.cgi?id=1869561#c20 . When *all* above happens:

- sos report run in verbose mode
- a plugin timeouts when still collecting files
- the plugin is/was running as the latest one

then there is a race condition where debug logs attempt to write to sos.log file that was already moved away from temp.location to the final destination.

I.e. https://github.com/sosreport/sos/issues/2722 needs to be fixed&backported.


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


How reproducible:
100%


Steps to Reproduce:
(bit artificial reproducer for QE):
sos report -o selinux --batch --build -k selinux.timeout=1 -vv

(real reproducer):
have a ppc64le system with hundreds of CPUs, such that collecting /sys/devices/system/cpu* takes >600s plugin timeout for sos report


Actual results:
a backtrace like:

Traceback (most recent call last):
  File "/usr/lib64/python3.6/logging/__init__.py", line 996, in emit
    stream.write(msg)
ValueError: I/O operation on closed file.
Call stack:
  File "/usr/lib64/python3.6/threading.py", line 884, in _bootstrap
    self._bootstrap_inner()
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 69, in _worker
    work_item.run()
  File "/usr/lib64/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/root/sos-main/sos/report/__init__.py", line 1083, in collect_plugin
    plug.collect()
  File "/root/sos-main/sos/report/plugins/__init__.py", line 2667, in collect
    self._collect_copy_specs()
  File "/root/sos-main/sos/report/plugins/__init__.py", line 2631, in _collect_copy_specs
    self._log_info("collecting path '%s'" % path)
  File "/root/sos-main/sos/report/plugins/__init__.py", line 706, in _log_info
    self.soslog.info(self._format_msg(msg))
Message: "[plugin:selinux] collecting path '/var/lib/selinux/targeted/active/modules/100/ntp/cil'"
Arguments: ()
[plugin:selinux] collecting path '/var/lib/selinux/targeted/active/modules/100/ntp/cil'



Expected results:
no backtrace / segfault


Additional info:

Comment 4 errata-xmlrpc 2022-05-17 15:51:43 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 (new packages: sos), 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-2022:3932