title: ffmpeg Python command only runs once in PM2 environment
body: <p>PM2 is running as a <code>web</code> user. ffmpeg was installed native to Ubuntu 16.04 LTS using <code>sudo apt install ffmpeg</code>. The Python version is 3.6. The software uses <a href="https://github.com/kkroening/ffmpeg-python" rel="nofollow noreferrer">ffmpeg-python@0.1.17</a>.</p>
  
  <p>The applications spawned produce no errors. When the ffmpeg code executes for the first time, we see an output and the ffmpeg process completes the task as expected. </p>
  
  <p>All subsequent requests stall on the next ffmpeg execution. No output. No return from the ffmpeg process. No errors. The PM2 process does not error out. The application log stalls on the ffmpeg command as though it is hung.</p>
  
  <p><strong>What is the root cause?</strong> Any help is deeply appreciated.</p>
  
  <p>Furthermore, what are the reasons PM2 hangs on a subprocess (like ffmpeg)?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>class ImageHelper:
  
  def __init__(self):
      pass
  
  @classmethod
  def create_thumb_from_video_ffmpeg(cls, input_video_file_path,
                                     output_image_path,
                                     scale_width,
                                     scale_height
                                     ):
      """
          This function is used to create the thumb image
          from a source video file.
          We are using a python wrapper/library for FFMPEG
      """
      try:
          if Functions.get_attribute_env('ENVIRONMENT') == 'prod':
  
              out, err = (
                  ffmpeg
                      .input(input_video_file_path, ss="00:00:00.001")
                      .filter('scale', scale_width, scale_height)
                      .output(output_image_path, vframes=1, loglevel='quiet')
                      .overwrite_output()
                      .run(capture_stdout=True)
              )
              print("We only see this once!")
          else:
              out, err = (
                  ffmpeg
                      .input(input_video_file_path, ss="00:00:00.001")
                      .filter('scale', scale_width, scale_height)
                      .output(output_image_path, vframes=1)
                      .overwrite_output()
                      .run(capture_stdout=True)
              )
              print("We only see this once!")
  
          if err:
              if Functions.get_attribute_env('ENVIRONMENT') != 'prod':
                  print('ffmpeg video thumb', err)
              else:
                  Functions.logger_function(str(err))
              raise Exception(err)
          else:
              return output_image_path
  
      except Exception as e:
          if Functions.get_attribute_env('ENVIRONMENT') != 'prod':
              print('in thumb exception', e)
          else:
              Functions.logger_function(str(e))
          raise Exception(e)
  </code></pre>