isislovecruft / python-gnupg

A modified version of python-gnupg, including security patches, extensive documentation, and extra features.
Other
426 stars 171 forks source link

GnuPG: OSError - Cannot allocate memory #263

Open manikanta-kondeti opened 5 years ago

manikanta-kondeti commented 5 years ago

Package details: python-gnupg==0.4.4 System specs: 4GB RAM, 2 core CPU

We're facing a problem with the GnuPG module.

We're using this module to encrypt our reports using a scheduler that triggers the report to generate them periodically.

Most of the times(once in 5 days) we're facing with the following issue: OSError - cannot allocate memory. Please help me out on how to diagnose and fix this problem.

[2019-05-30 02:04:05,042] {/home/project/lib/python3.6/site-packages/gnupg.py:845} ERROR Unable to run gpg (gpg) - it may not be available.
Traceback (most recent call last):
  File "/home/project/lib/python3.6/site-packages/gnupg.py", line 842, in __init__
    p = self._open_subprocess(["--version"])
  File "/home/project/lib/python3.6/site-packages/gnupg.py", line 923, in _open_subprocess
    startupinfo=si)
  File "/usr/lib64/python3.6/subprocess.py", line 709, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.6/subprocess.py", line 1275, in _execute_child
    restore_signals, start_new_session, preexec_fn)
OSError: [Errno 12] Cannot allocate memory
fabrizio8 commented 4 years ago

Your computer is out of memory. The gnupg module attempts to start another process but fails because the OS won't give it memory. The solution is to add more physical memory or allocate/increase the size of a swap partition.