The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

chkservd is not adequately restarting apache

Discussion in 'General Discussion' started by Erik Knepfler, Jul 20, 2016.

  1. Erik Knepfler

    Erik Knepfler Member

    Joined:
    Sep 2, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Long Beach, California, United States
    cPanel Access Level:
    Root Administrator
    httpd went down for nearly 30 minutes today, need advice:

    /var/log/chkservd.log
    ...httpd [Timeout while trying to connect to service: Died][check command:N/A][socket connect:-][socket failure threshold:6/2][fail count:5]Restarting httpd....
    [notify:failed service:httpd]]...

    This message just kept repeating on every chkservd cycle. Note the 6/2 failure threshold

    /usr/local/apache/logs/error_log
    [mpm_prefork:notice] [pid 21770] AH00171: Graceful restart requested, doing restart

    This graceful restart request was repeating in the log and not really accomplishing much it seems.

    When I noticed, I went into WHM and restarted HTTPD via the Restart Services, which appears to use a stronger restart method. This resulted in many of these in the apache error_log:

    [Wed Jul 20 09:48:57.695425 2016] [core:warn] [pid 21770] AH00045: child process 20673 still did not exit, sending a SIGTERM

    After that, everything was fine.

    This makes me feel that I'd like to reconfigure chkservd to use a stronger restart method, as Graceful doesn't appear to be cutting it in some situations.

    Thoughts?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    Internal case CPANEL-1443 is open to address concerns that "restartsrv" doesn't clean up or provide a consistent environment before starting services such as Apache. In particular, in notes the difference between graceful restarts with Apache and using a full stop/start command. There's currently no specific time frame on a resolution, however I've added a link to this thread to the case, and will update this thread with any new information as it becomes available.

    Thank you.
     
  3. Erik Knepfler

    Erik Knepfler Member

    Joined:
    Sep 2, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Long Beach, California, United States
    cPanel Access Level:
    Root Administrator
    Perhaps I could simply replace /scripts/restartsrv_httpd with a text file with contents of apachectl -k restart instead of having it be a symlink to restartsrv_base which is binary and I can't edit? I'm afraid to do that since I don't know what else restartsrv_base might be doing.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I don't suggest manually replacing this file with a symbolic link to another location. Here are the commands that Chkservd uses to restart Apache:

    Code:
    # cat /etc/chkserv.d/httpd
    service[httpd]=80,GET / HTTP/1.0,HTTP/1..,killall -TERM httpd;sleep 2;killall -9 httpd;/etc/rc.d/init.d/httpd stop;/etc/rc.d/init.d/httpd startssl;/usr/local/apache/bin/apachectl startssl;/etc/rc.d/init.d/httpd start;/usr/local/apache/bin/apachectl start
    
    You can edit this file, however you may want to first determine what's resulting in Apache failing to respond.

    Thank you.
     
  5. Erik Knepfler

    Erik Knepfler Member

    Joined:
    Sep 2, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Long Beach, California, United States
    cPanel Access Level:
    Root Administrator
    I believe it's an OOM condition that's not easy to figure out. I'm working on that. But when chkservd is stuck in that loop, unable to restart Apache, why does clicking Restart Services > HTTP Server (Apache) work fine to fix it immediately? The two restart scripts must be doing it differently. That link in WHM seems to run something called /scripts/reshttpd (according to the URL) but I cannot find this script to compare them and maybe copy parts of how that works over to /etc/chkdserv.d/httpd - can you point me in the right direction?
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  7. Erik Knepfler

    Erik Knepfler Member

    Joined:
    Sep 2, 2014
    Messages:
    11
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Long Beach, California, United States
    cPanel Access Level:
    Root Administrator
    I'm using EasyApache3 because my CentOS hasn't been updated quite yet

    uname -a:
    Linux servernamehere 2.6.18-408.el5 #1 SMP Tue Jan 19 09:14:52 EST 2016 x86_64 x86_64 x86_64 GNU/Linux

    rpm --query centos-release:
    centos-release-5-11.el5.centos
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Would you mind opening a support ticket using the link in my signature so we can take a closer look and reproduce the issue on your system? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
Loading...

Share This Page