最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Python GnuPG - Cannot allocate memory issue - Stack Overflow

programmeradmin4浏览0评论

Intermittently getting cannot allocate memory error while decrypting a file via python gnupg package

To Reproduce

Initialize the gpg agent and decrypt the file : gpg_obj = gnupg.GPG(gnupghome=os.path.expanduser('~')) gpg_obj.encoding = 'utf-8' gpg_obj.decrypt_file()

Exact Error

\ngpg: public key decryption failed: Cannot allocate memory\n[GNUPG:] ERROR pkdecrypt_failed 67141718\n[GNUPG:] BEGIN_DECRYPTION\n[GNUPG:] DECRYPTION_FAILED\ngpg: decryption failed: No secret key\n[GNUPG:] END_DECRYPTION\n

Environment

OS, including version : Ubuntu 20.04.6 LTS Version of this library: python-gnupg==0.5.0 Version of GnuPG: gpg (GnuPG) 2.2.19, libgcrypt 1.8.5 Note : Sufficient RAM is available (around 14/32GB is available) when this issue occurrs

Saw here that using the option --auto-expand-secmem has solved the issue for lot of people. However I could not see anything mentioned about how to use this option via the python gnupg package. And I am facing a critical issue regarding this. It would be great if I can get help reg:

  • How can I use this option in the gnupg package
  • Is there a way to limit the max memory being used via this option since in the worst case I want to avoid this consuming the majority of system's RAM
发布评论

评论列表(0)

  1. 暂无评论