1

I am configuring a cache for a Django project, using the MemcachedCache backend.

I have tested it in local and in preproduction server and it works like a charm. But when I deploy it on production server I get multiple errors about segmentation faults just after restart apache, like the followings:

[mpm_prefork:notice] [pid 40094] AH00169: caught SIGTERM, shutting down
[mpm_prefork:notice] [pid 27734] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 OpenSSL/1.0.1f mod_wsgi/3.4 Python/2.7.6 configured $
[core:notice] [pid 27734] AH00094: Command line: '/usr/sbin/apache2'
[core:notice] [pid 27734] AH00052: child pid 28214 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28225 exit signal Segmentation fault (11)
[crit] Memory allocation failed, aborting process.
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[core:notice] [pid 27734] AH00052: child pid 28239 exit signal Aborted (6)
[core:notice] [pid 27734] AH00052: child pid 28279 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00051: child pid 28280 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[core:notice] [pid 27734] AH00052: child pid 28313 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28335 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28355 exit signal Segmentation fault (11)
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[core:notice] [pid 27734] AH00052: child pid 28278 exit signal Segmentation fault (11)
[core:notice] [pid 27734] AH00052: child pid 28336 exit signal Segmentation fault (11)
[mpm_prefork:error] [pid 27734] (12)Cannot allocate memory: AH00159: fork: Unable to fork new process
[crit] Memory allocation failed, aborting process.
...

I don't understand it, because preproduction server has less memory than production server (about the half).

Could you help me to figure out the problem or error behind this behavior?

Stratford
  • 325
  • 1
  • 2
  • 11

1 Answers1

-1

Use

free -m

to check your available memory.

If you are running out of available memory this link https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04 tutorial may help to create a swap file.

If you continue to encounter these problems even after creating a swap file you may need to upgrade to a larger droplet (but i doubt this would be ur case)

Ghassan Zein
  • 4,089
  • 3
  • 19
  • 30
  • Thanks for your answer! I already check the free memory, and was about 500. More or less the same in preproduction and production servers, but preprod don't raise the errors... I will try to create a swap file even so. – Stratford Jun 08 '16 at 12:08
  • Ok let's hope it's gonna work.. Please vote for the answer so people can follow it as well :) thx – Ghassan Zein Jun 08 '16 at 13:07
  • I have tried to set 4G of swap, but when I restart apache and run 'free -m', the whole swap memory is in use and I still get the errors, but this time about the wsgi script cannot be loaded as Python module. I don't understand why the same code works fine in preprod and have this behavior in prod... -.- – Stratford Jun 09 '16 at 08:12