Anyone encountered the same issue like this?

Apache will just restart after several minute or idle time.

Here’s the logs.

[Wed Sep 18 08:40:31.204318 2019] [core:notice] [pid 3704] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 18 08:43:12.823934 2019] [mpm_prefork:notice] [pid 3704] AH00171: Graceful restart requested, doing restart
[Wed Sep 18 08:43:12.940468 2019] [mpm_prefork:notice] [pid 3704] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1c configured -- resuming normal operations
[Wed Sep 18 08:43:12.940499 2019] [core:notice] [pid 3704] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 18 08:43:22.975687 2019] [mpm_prefork:notice] [pid 3704] AH00171: Graceful restart requested, doing restart
[Wed Sep 18 08:43:23.094698 2019] [mpm_prefork:notice] [pid 3704] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1c configured -- resuming normal operations
[Wed Sep 18 08:43:23.094739 2019] [core:notice] [pid 3704] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 18 08:43:43.479448 2019] [mpm_prefork:notice] [pid 3704] AH00169: caught SIGTERM, shutting down
[Wed Sep 18 08:43:43.677845 2019] [mpm_prefork:notice] [pid 5070] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1c configured -- resuming normal operations
[Wed Sep 18 08:43:43.677948 2019] [core:notice] [pid 5070] AH00094: Command line: '/usr/sbin/apache2'
[Wed Sep 18 08:46:55.304779 2019] [mpm_prefork:notice] [pid 5070] AH00173: SIGHUP received.  Attempting to restart
[Wed Sep 18 08:46:55.358171 2019] [mpm_prefork:notice] [pid 5070] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1c configured -- resuming normal operations
[Wed Sep 18 08:46:55.358218 2019] [core:notice] [pid 5070] AH00094: Command line: '/usr/sbin/apache2'

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

Hello, @Menj

Can you please check the /var/log/messages for any killed processes? The apache process may be killed if it’s using a lot of resources. You can check this using the following command:

grep -i kill /var/log/messages

You can then check if there are any references for apache as well or you can modify the command to show those related with apache:

grep -i kill /var/log/messages | grep apache

Let me know how it goes.
Alex

Hi @alexdo

I am getting like this after running your commands

grep: /var/log/messages: No such file or directory

Please let me know how to solve this problem.

Hello, @akhileswar @Menj

Ubuntu no longer uses the /var/log/messages file by default. The same information is available in the file /var/log/syslog. You can re-enable logging to /var/log/messages if you would like.

You can use the following command:

grep -i kill /var/log/syslog | grep apache

Let me know how it goes.

Regards,
Alex

  • i have also same issue and i ran above command grep -i kill /var/log/syslog | grep apache and got this screen

    May 19 08:22:06 educationportal kernel: [77466.823101] Out of memory: Kill proce ss 5540 (apache2) score 9 or sacrifice child
    May 19 08:22:06 educationportal kernel: [77466.826031] Killed process 5540 (apac he2) total-vm:576044kB, anon-rss:12792kB, file-rss:1952kB, shmem-rss:620kB
    May 19 08:22:27 educationportal kernel: [77486.958692] Out of memory: Kill proce ss 4660 (apache2) score 9 or sacrifice child
    May 19 08:22:27 educationportal kernel: [77486.961646] Killed process 4660 (apac he2) total-vm:578080kB, anon-rss:1324kB, file-rss:0kB, shmem-rss:140kB
    May 19 08:22:27 educationportal kernel: [77490.674496] apache2 invoked oom-kille r: gfpmask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore adj=0
    May 19 08:22:28 educationportal kernel: [77490.675429] Out of memory: Kill proce ss 5453 (apache2) score 9 or sacrifice child
    May 19 08:22:28 educationportal kernel: [77490.677672] Killed process 5453 (apac he2) total-vm:576036kB, anon-rss:11612kB, file-rss:1676kB, shmem-rss:756kB
    May 19 08:22:40 educationportal kernel: [77505.168669] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:22:46 educationportal kernel: [77505.169575] Out of memory: Kill proce ss 5625 (apache2) score 10 or sacrifice child
    May 19 08:22:46 educationportal kernel: [77505.171919] Killed process 5625 (apac he2) total-vm:576392kB, anon-rss:13088kB, file-rss:1728kB, shmem-rss:1352kB
    May 19 08:23:05 educationportal kernel: [77522.876592] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:23:23 educationportal kernel: [77522.877540] Out of memory: Kill proce ss 5169 (apache2) score 9 or sacrifice child
    May 19 08:23:23 educationportal kernel: [77522.879773] Killed process 5169 (apac he2) total-vm:577680kB, anon-rss:1324kB, file-rss:124kB, shmem-rss:140kB
    May 19 08:23:23 educationportal kernel: [77537.524411] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:23:23 educationportal kernel: [77537.525362] Out of memory: Kill proce ss 5704 (apache2) score 9 or sacrifice child
    May 19 08:23:23 educationportal kernel: [77537.527532] Killed process 5704 (apac he2) total-vm:574948kB, anon-rss:13268kB, file-rss:1480kB, shmem-rss:1204kB
    May 19 08:23:23 educationportal kernel: [77541.944344] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:23:23 educationportal kernel: [77541.945398] Out of memory: Kill proce ss 5768 (apache2) score 9 or sacrifice child
    May 19 08:23:23 educationportal kernel: [77541.947647] Killed process 5768 (apac he2) total-vm:575008kB, anon-rss:2992kB, file-rss:2380kB, shmem-rss:200kB
    May 19 08:23:37 educationportal kernel: [77562.232959] Out of memory: Kill proce ss 5207 (apache2) score 9 or sacrifice child
    May 19 08:23:37 educationportal kernel: [77562.235206] Killed process 5207 (apac he2) total-vm:574860kB, anon-rss:2132kB, file-rss:1336kB, shmem-rss:1676kB
    May 19 08:23:40 educationportal kernel: [77565.309359] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:23:40 educationportal kernel: [77565.310258] Out of memory: Kill proce ss 5270 (apache2) score 9 or sacrifice child
    May 19 08:23:40 educationportal kernel: [77565.312448] Killed process 5270 (apac he2) total-vm:653696kB, anon-rss:1056kB, file-rss:0kB, shmem-rss:112kB
    May 19 08:24:37 educationportal kernel: [77593.338620] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:24:37 educationportal kernel: [77593.339589] Out of memory: Kill proce ss 5527 (apache2) score 9 or sacrifice child
    May 19 08:24:37 educationportal kernel: [77593.341753] Killed process 5527 (apac he2) total-vm:577196kB, anon-rss:3808kB, file-rss:212kB, shmem-rss:0kB
    May 19 08:24:37 educationportal kernel: [77613.756490] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:24:37 educationportal kernel: [77613.757534] Out of memory: Kill proce ss 5351 (apache2) score 9 or sacrifice child
    May 19 08:24:37 educationportal kernel: [77613.759859] Killed process 5351 (apac he2) total-vm:575220kB, anon-rss:2276kB, file-rss:1800kB, shmem-rss:984kB
    May 19 08:24:45 educationportal kernel: [77630.483778] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oomscore _adj=0
    May 19 08:24:49 educationportal kernel: [77630.484687] Out of memory: Kill proce ss 5719 (apache2) score 9 or sacrifice child
    May 19 08:24:49 educationportal kernel: [77630.486923] Killed process 5719 (apac he2) total-vm:651580kB, anon-rss:4504kB, file-rss:0kB, shmem-rss:96kB
    May 19 08:24:49 educationportal kernel: [77634.159193] apache2 invoked oom-kille r: gfp
    mask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oom_score _adj=0

    what shoudl i do

    • Hello, @jaiswaldilip8

      As you can see from the logs the server is having issues with the memory and the oom killer is basically killing the apache processes in order to keep the server up and running,

      You can see this from the references in the log:

      Out of memory: Kill proce ss 5719 (apache2) score 9 or sacrifice child
      May 19 08:24:49 educationportal kernel: [77630.486923] Killed process 5719 (apac he2) total-vm:651580kB, anon-rss:4504kB, file-rss:0kB, shmem-rss:96kB
      May 19 08:24:49 educationportal kernel: [77634.159193] apache2 invoked oom-kille r: gfpmask=0x14200ca(GFPHIGHUSERMOVABLE), nodemask=(null), order=0, oom_score _adj=0
      

      If memory is exhaustively used up by processes, to the extent which can possibly threaten the stability of the system, then the OOM killer comes into the picture. The OOM Killer has to select the best process(es) to kill. Best here refers to that process which will free up the maximum memory upon killing and is also the least important to the system.

      What you can do is to upgrade the RAM of the droplet in order to sort the issue out. This will be the best approach for the problem.

      Hope this helps! Let me know if you have any questions.

      Regards,
      Alex

Submit an Answer