Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[plugins] investigate exception propagation from _copy_dir() #480

Closed
bmr-cymru opened this issue Jan 28, 2015 · 7 comments
Closed

[plugins] investigate exception propagation from _copy_dir() #480

bmr-cymru opened this issue Jan 28, 2015 · 7 comments

Comments

@bmr-cymru
Copy link
Member

Commit a668851 works around a problem that causes sos to abruptly terminate in Docker container environments:

  >>> import os
  >>> os.listdir("/host/proc/sys/fs/binfmt_misc/")
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  OSError: [Errno 2] No such file or directory: '/host/proc/sys/fs/binfmt_misc/'

Handling the OSError in _copy_dir() itself gives the desired behaviour but it's unclear why this wasn't already caught (and either re-raised or logged but allowing the rest of the sos run to continue) by the existing high-level exception handling.

@bmr-cymru
Copy link
Member Author

Where is the original backtrace? That would tell us why it was not caught.

@BryanQuigley
Copy link
Contributor

cat sos_logs/kernel-plugin-errors.txt
Traceback (most recent call last):
File "/root/sos/sos/sosreport.py", line 1320, in collect_plugin
plug.collect()
File "/root/sos/sos/plugins/init.py", line 940, in collect
self._collect_copy_specs()
File "/root/sos/sos/plugins/init.py", line 898, in _collect_copy_specs
self._do_copy_path(path)
File "/root/sos/sos/plugins/init.py", line 435, in _do_copy_path
self._copy_dir(srcpath)
File "/root/sos/sos/plugins/init.py", line 387, in _copy_dir
raise e
File "/root/sos/sos/plugins/init.py", line 378, in _copy_dir
for afile in os.listdir(srcpath):
PermissionError: [Errno 13] Permission denied: '/sys/fs/pstore'

@bmr-cymru
Copy link
Member Author

Thanks!

@bmr-cymru
Copy link
Member Author

Two possible things here - am in a meeting right now but I'll try to update later.

@BryanQuigley
Copy link
Contributor

I'm currently looking at just moving that bit to walk - BryanQuigley@82633f5

seems to work in my testing so far.. need to add reporting for errors.. It may actually be possible to move all of copy_path to walk but testing that was complicated...

@BryanQuigley
Copy link
Contributor

@slashdd in 3.7 testing I refound this for LXD containers. Don't see why it moved from kernel->system though (was system in 3.6 afaict)

sos_logs/system-plugin-errors.txt
Traceback (most recent call last):
File "/usr/share/sosreport/sos/sosreport.py", line 1020, in collect_plugin
plug.collect()
File "/usr/share/sosreport/sos/plugins/init.py", line 1205, in collect
self._collect_copy_specs()
File "/usr/share/sosreport/sos/plugins/init.py", line 1160, in _collect_copy_specs
self._do_copy_path(path)
File "/usr/share/sosreport/sos/plugins/init.py", line 653, in _do_copy_path
self._copy_dir(srcpath)
File "/usr/share/sosreport/sos/plugins/init.py", line 599, in _copy_dir
self._do_copy_path(os.path.join(srcpath, afile), dest=None)
File "/usr/share/sosreport/sos/plugins/init.py", line 653, in _do_copy_path
self._copy_dir(srcpath)
File "/usr/share/sosreport/sos/plugins/init.py", line 599, in _copy_dir
self._do_copy_path(os.path.join(srcpath, afile), dest=None)
File "/usr/share/sosreport/sos/plugins/init.py", line 653, in _do_copy_path
self._copy_dir(srcpath)
File "/usr/share/sosreport/sos/plugins/init.py", line 596, in _copy_dir
for afile in os.listdir(srcpath):
PermissionError: [Errno 13] Permission denied: '/proc/sys/fs/binfmt_misc'

@TurboTurtle
Copy link
Member

Closing as I believe this has been handled in previous versions with regards to container detection and execution support, but perhaps most notably e10473d to log the exception rather than allow it to be uncaught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants