-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak when Archive Download fails #1235
Comments
Possibly worth adding: the Linux "zip" command can build these archives much faster than the Perl modules Sympa is using. |
Archive::Zip is now discouraged, because it is memory-consuming: Use of Archive::Zip::SimpleZip/SimpleUnzip is encouraged. However, for some environments not providing Archive::Zip::Simple*, Archive::Zip may be used as workaround.
@dpc22 , can you check this patch? |
The patch applies, but Archive-Zip-SimpleZip isn't available from the RHEL base or EPEL repositories, so I will need to install it using CPAN or such like. All of the other Perl dependencies for Sympa are available from EPEL. I'm also a bit dubious about : "Module version: 0.040", although I guess version numbers are fairly arbitrary. wwsympa is creating a temporary .zip file in /var/spool/sympa/tmp. Is there a particular reason that we can't use /usr/bin/zip to generate that file if it is available? I would expect the command line tool to be much more readily available than Archive-Zip-SimpleZip. |
For example, zip is not present on a basic Debian installation. |
Presumably you can install it using "apt get zip" though? I don't think that Archive-Zip-SimpleZip is available on Debian/Ubuntu either unless it is called something other than simplezip |
Yes, you can install it of course. Just saying that we can't assume that zip is installed. |
@dpc22, for the presnt, you have to install it manually, e.g. using cpanm (see the description). I think the problem is caused by the fact that Archive::Zip keeps the entire generated archive in memory. And Archive::Zip::SimpleZip seems to work around this problem. If Archive::Zip::SimpleZip would solve the problem, we will add it to dependency (see |
I seem to have ended up in Perl dependency hell:
RHEL7 currently provides perl-IO-Compress-2.061 I will set up a throwaway VM to test the patch, but I don't want to fight the Redhat package manager on my production servers, which are carefully managed using Ansible. Archive-Zip-SimpleZip-0.021 looks plausible when we upgrade from RHEL 7 to RHEL 8 (probably next summer). In the mean time noone has actually complained that I have disabled archive downloads. |
Okay, I can confirm that the patch plus Archive-Zip-SimpleZip definitely fixes the issue that I reported. It takes about 25 seconds for Sympa to generate and a Web browser to download:
compared to about 20 seconds for the command line "zip" command to generate the raw archive, so not shabby at all. wwsympa.pl doesn't appear to have leaked substantial amounts of memory in the process. If I remove Archive::Zip::SimpleZip, the same archive download times out and leaks lots of memory just as before, but it has transparently fallen back to Archive::Zip. In order to install Archive::Zip::SimpleZip, cpanm needed to upgrade or install the following on RHEL7. Not as bad as I had feared, particularly given that cpanm seems to have installed its packages to /usr/local/share/perl5/ rather than /usr/share/perl5, which makes it simpler to revert.
|
Now deployed on the live server. I will let you know if there turn out to be any complications. Thanks. |
@dpc22, thanks for confirming! This PR will be merged for now, in some days. However if you notice anything, please let us know. |
Memory consumption while archive download (#1235).
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use Archive-Zip-SimpleZip instead. See also GH issue sympa-community#1235.
Version
6.2.64
Installation method
My own rpm, derived from official source RPM. Redhat Enterprise Server 7.
Expected behavior
wwsympa.pl should not leak 4 GBytes of memory when an archive download fails.
Actual behavior
(Output from Linux top command):
4.2g is 4.2 Gytes of Residient Set Size. That starts as about 200 MBytes.
Additional Information
One of my list owners attempted to download a 1.3 GBytes ZIP archive of their mail archives (about 3 to 4 GBytes of raw data).
Apache timed out after (I think) 60 seconds: it is possible I need to increase the Apache default timeout. That left the wwsympa.fcgi process in question using 4.2 GBytes RSS, which does not appear to be returned to the system.
The list owner then repeated the process multiple times until all of the wwsympa processes were 4.2 GBytes in size.
I think that there might also be slow memory leaks in other Sympa daemons, but this largely explains why a virtual machine with 16 GBytes RAM was swapping like mad this morning until I restarted wwsympa. It normally only uses about 6 GBytes, with the rest spare/as buffer cache. OOM killer had stepped in, which is never a good sign on Linux.
I don't think that this memory leak happens if the download is successful. However I think that I will disable list archive downloads for the time being...
The text was updated successfully, but these errors were encountered: