oamg/leapp

wrong fd in __write_raw (run logger).

Closed this issue · 1 comments

I have no reproducer yet. I found that with my own rpm but the problem looks weird:

9062 Apr 09 16:24:03 localhost upgrade[312]: 2019-04-09 16:24:03.249 INFO     PID: 1 leapp.workflow.Finalization: Executing actor initrdinclude
9063 Apr 09 16:24:03 localhost upgrade[312]: 2019-04-09 16:24:03.325 DEBUG    PID: 308 leapp.workflow.Finalization.initrdinclude: External command is started: [rpm -q kernel]
9064 Apr 09 16:24:03 localhost upgrade[312]: 2019-04-09 16:24:03.571 DEBUG    PID: 308 leapp.workflow.Finalization.initrdinclude: External command is finished: [rpm -q kernel]
9065 Apr 09 16:24:03 localhost upgrade[312]: Process Process-63:                     
9066 Apr 09 16:24:03 localhost upgrade[312]: Traceback (most recent call last):      
9067 Apr 09 16:24:03 localhost upgrade[312]:   File "/usr/lib64/python3.6/multiprocessing/process.py", line 258, in _bootstrap
9068 Apr 09 16:24:03 localhost upgrade[312]:     self.run()                          
9069 Apr 09 16:24:03 localhost upgrade[312]:   File "/usr/lib64/python3.6/multiprocessing/process.py", line 93, in run
9070 Apr 09 16:24:03 localhost upgrade[312]:     self._target(*self._args, **self._kwargs)
9071 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/repository/actor_definition.py", line 59, in _do_run
9072 Apr 09 16:24:03 localhost upgrade[312]:     target_actor(logger=logger, messaging=messaging).run(*args, **kwargs)
9073 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/actors/__init__.py", line 299, in run
9074 Apr 09 16:24:03 localhost upgrade[312]:     self.process(*args)                 
9075 Apr 09 16:24:03 localhost upgrade[312]:   File "/etc/leapp/repos.d/system_upgrade/el7toel8/actors/initrdinclude/actor.py", line 38, in process
9076 Apr 09 16:24:03 localhost upgrade[312]:     kernel_version = self.get_rhel8_kernel_version()
9077 Apr 09 16:24:03 localhost upgrade[312]:   File "/etc/leapp/repos.d/system_upgrade/el7toel8/actors/initrdinclude/actor.py", line 20, in get_rhel8_kernel_version
9078 Apr 09 16:24:03 localhost upgrade[312]:     kernels = run(["rpm", "-q", "kernel"], split=True)["stdout"]
9079 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/libraries/stdlib/__init__.py", line 135, in run
9080 Apr 09 16:24:03 localhost upgrade[312]:     result = _call(args, callback_raw=callback_raw)
9081 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/libraries/stdlib/call.py", line 163, in _call
9082 Apr 09 16:24:03 localhost upgrade[312]:     **extra                             
9083 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/libraries/stdlib/call.py", line 50, in _multiplex
9084 Apr 09 16:24:03 localhost upgrade[312]:     callback_raw((fd, fd_type), read)   
9085 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/libraries/stdlib/__init__.py", line 112, in _logging_handler
9086 Apr 09 16:24:03 localhost upgrade[312]:     __write_raw(fd_info, buffer)        
9087 Apr 09 16:24:03 localhost upgrade[312]:   File "/root/tmp_leapp_py3/leapp/libraries/stdlib/__init__.py", line 92, in __write_raw
9088 Apr 09 16:24:03 localhost upgrade[312]:     os.writev(fd, [buffer])             
9089 Apr 09 16:24:03 localhost upgrade[312]: OSError: [Errno 9] Bad file descriptor  
9090 Apr 09 16:24:03 localhost upgrade[312]: ==============================================================================================
9091 Apr 09 16:24:03 localhost upgrade[312]: Actor initrdinclude unexpectedly terminated with exit code: 1 - Please check the above details
9092 Apr 09 16:24:03 localhost upgrade[312]: ==============================================================================================

- putting it here for now in case someone get idea what's the issue. (Running on Python3)

We should get more info about that. Maybe we would need catch & add additional data in the code.

Problem discovered here. We use fd used for reading (stdin of the child process) for writting. Previously we didn't see the issue, because we used just info fd_type to check whether output should go to stdout or stderr and the fd itself was ignored. I am not sure whether there is wrong documentation or implementation.