Search code examples
pythonsubprocessorcaappimage

subprocess.call() Hangs. "os.waitpid(self.pid, wait_flags)"


I have a strange issue that I haven't run into before. I have a script to deliver PDF reports on a given time period. This worked up until now just fine, but I had made some updates and pulled those changes onto the server. Now my process hangs at subprocess.call() and I'm not sure why.

I have read this can be an issue when using PIPEs, but I'm not. I'm unsure even how I might debug this issue. Any ideas?

subprocess.call(
                ['{}/orca.sh'.format(orca_dir),
                 'graph',
                 json.dumps(chart, cls=plotly.utils.PlotlyJSONEncoder),
                 '--width',
                 '1200',
                 '--scale',
                 '4',
                 '-o',
                 '/temp/{}'.format("a" + (count * "a"))]
)



 File "/root/**", line 97, in **
    '/temp/{}'.format("a" + (count * "a"))])
  File "/root/anaconda3/envs/**/lib/python3.7/subprocess.py", line 325, in call
    return p.wait(timeout=timeout)
  File "/root/anaconda3/envs/**/lib/python3.7/subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "/root/anaconda3/envs/**/lib/python3.7/subprocess.py", line 1624, in _wait
    (pid, sts) = self._try_wait(0)
  File "/root/anaconda3/envs/**/lib/python3.7/subprocess.py", line 1582, in _try_wait
    (pid, sts) = os.waitpid(self.pid, wait_flags)

orca.sh executes Orca's AppImage container to execute their standalone software with the given parameters. It's also worth noting I run this script on two servers, but the second one is pre-update and still works perfectly fine. None of the changes I've made have been made to how this call is made or how it should work. Could it be something within the AppImage container causing me to hang?


Solution

  • Identified the issue.

    My script which compiled a list of Plotly Objects to produce these charts failed to correctly produce the first plotly object. So the first object was NoneType, but subprocess.call() was called with each member of the list. Unfortunately, since AppImage didn't receive the chart data, it seems it just hung indefinitely.