Learn about Centmin Mod LEMP Stack today
Register Now

[Solved] centmin.sh takes up 100% when forced termination

Discussion in 'Bug Reports' started by EckyBrazzz, Apr 19, 2019.

Tags:
  1. EckyBrazzz

    EckyBrazzz Active Member

    230
    40
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +78
    Local Time:
    2:24 PM
    1.15.x
    10.3.x
    Noticed already several times that centmin.sh takes up 100% of 1 core / session when hitting crtl-c after confirmation "Do you want to continue (y/n)"

    It can happen that you are not sure about a certain version to recompile after that you hit yes and you might want to quit centmin.sh to verify what to do or eventually still want to cancel for another reason. There should be a routine that checks this event to prevent overloading of the server. Screenshot_7.png
     
  2. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    which centmin.sh menu option ?

    i take it, this is with centmin command and not via
    Code (Text):
    cmdir
    ./centmin.sh

    try with these 2 commands and see if it happens

    also which SSH client app you using to log into server ? does same problem happen if you use a different SSH client app ?
     
  3. EckyBrazzz

    EckyBrazzz Active Member

    230
    40
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +78
    Local Time:
    2:24 PM
    1.15.x
    10.3.x
    Sorry, confusion, guess a lack of sleep. Try to work 24/7 but that's impossible.

    It happens when you start centmin.sh and hit crtl-z any were inside centmin.sh. Just did some testing to verify becuase you asked which centmin.sh menu option.
     
  4. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ctrl+z or ctrl+c ?

    ctrl+z puts script in background instead of terminating the script https://askubuntu.com/questions/510...nce-between-ctrl-z-and-ctrl-c-in-the-terminal


    so right command should be ctrl+c not ctrl+z to terminate centmin.sh
     
    Last edited: Apr 19, 2019
  5. EckyBrazzz

    EckyBrazzz Active Member

    230
    40
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +78
    Local Time:
    2:24 PM
    1.15.x
    10.3.x
    Thanks for the info about crtl-z and ctrl-c.

    But ctlr-c on option 4 gives 100%, on option 5 it return to the main but becomes unresponsible.
     
  6. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    when / at what stage in centmin.sh menu option 5 process are you hitting ctrl+c ? I have used ctrl+c to abort centmin.sh menu option 5 mid run without such high loads as centmin.sh has the code to abort ctrl+c when detected

    which SSH client app you using to log into server ? does same problem happen if you use a different SSH client app ?

    if you have done multiple ctrl+z runs, you could of left some background centmin.sh in place and that is what you're seeing the load from ?
     
  7. EckyBrazzz

    EckyBrazzz Active Member

    230
    40
    28
    Mar 28, 2018
    Brazil
    Ratings:
    +78
    Local Time:
    2:24 PM
    1.15.x
    10.3.x
    Code (Text):
    [13:16][[email protected]]# % 20767
    centmin
    

    will not return to centmin, it just hangs there. but forcing it to quit also quits the proces 20767 (100% CPU usage)
    Code (Text):
    --------------------------------------------------------
    Enter option [ 1 - 24 ] 5
    --------------------------------------------------------
    
    Do you want to run YUM install checks ?  [y/n]
    
    This will increase your upgrade duration time wise.
    Check the change log centminmod.com/changelog.html
    to see if any Nginx or PHP related new additions
    which require checking YUM prequisites are met.
    If no new additions made, you can skip the
    YUM install check to speed up upgrade time.
    
     [y/n]: n
         ____   _   _  ____       _   _                                _       
        |  _ \ | | | ||  _ \  _  | | | | _ __    __ _  _ __  __ _   __| |  ___
        | |_) || |_| || |_) |(_) | | | || '_ \  / _` || '__|/ _` | / _` | / _ \
        |  __/ |  _  ||  __/  _  | |_| || |_) || (_| || |  | (_| || (_| ||  __/
        |_|    |_| |_||_|    (_)  \___/ | .__/  \__, ||_|   \__,_| \__,_| \___|
                                        |_|     |___/                         
    PHP Upgrade/Downgrade - Would you like to continue? [y/n] y
    
    ----------------------------------------------------------------
    Install which version of PHP? (version i.e. 5.6.40, 7.0.33, NGDEBUG)
    PHP 7.x/7.1.x/7.2.x/7.3.x is GA Stable but still may have broken PHP extensions.
    NGDEBUG is PHP 7.4.0 dev builds minus incompatible PHP extensions
    ----------------------------------------------------------------
    
    Current PHP Version: 7.2.17
    
    Enter PHP Version number you want to upgrade/downgrade to:
    

    Hitting crtl-c retruns to main menu but becomes unrespovible. It does not give 100%CPU usage, that only happend with option 4 - nginx

    SecureCRT. Did not test it on others.
     
  8. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    from https://askubuntu.com/a/510816
    I use SecureCRT and ctrl+c for me in either menu option 4 or 5 will terminate to SSH command line for me - totally exiting centmin.sh menu and never returns to main menu. May I ask what terminal emulation mode you are using in SecureCRT. I use Xterm

    securecrt-terminal-emulation-01.png
    securecrt-terminal-emulation-02.png

    So i can't reproduce your issue. I think for now I will add a 2nd do you want to continue prompt after entering version numbers so you do not need to do ctrl+c at that stage at least and also add ctrl+z signal, SIGTSTP to centmin.sh menu's trap routine so centmin.sh menu exits on ctrl+z signal SIGTSTP detection too as it does for ctrl+c.

    Code (Text):
    Nginx Upgrade - Would you like to continue? [y/n] y
    
    Current Nginx Version: 1.15.12 (160419-155206-centos7)
    
    Install which version of Nginx? (version i.e. type 1.15.12): 1.15.12
    
    Do you still want to continue? [y/n] n
    
    Total Nginx Upgrade Time: 16.839843388 seconds
    --------------------------------------------------------
         Centmin Mod Menu 123.09beta01 centminmod.com     
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB MySQL Upgrade & Management
    12). Zend OpCache Install/Re-install
    13). Install/Reinstall Redis PHP Extension
    14). SELinux disable
    15). Install/Reinstall ImagicK PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: zstd,pigz,pbzip2,lbzip2
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Install/Re-Install
    21). Update - Nginx + PHP-FPM + Siege
    22). Add Wordpress Nginx vhost + Cache Plugin
    23). Update Centmin Mod Code Base
    24). Exit
    --------------------------------------------------------
    Enter option [ 1 - 24 ]
    
     
    Last edited: Apr 20, 2019
  9. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ok found the problem it's do with how you initially call centmin.sh menu. The problem you have is when you type command = centmin to call centmin.sh as /usr/bin/centmin is the command script which calls centmin.sh so centmin.sh menu is running as a child script of /usr/bin/centmin in a subshell so when you exit (ctrl+c) or move to background (ctrl+z) centmin.sh, you are leaving the parent /usr/bin/centmin running.

    I usually run centmin.sh via
    Code (Text):
    cmdir
    ./centmin.sh
    

    which changes to /usr/local/src/centmin directory and directly calls centmin.sh so when you exit (ctrl+c) or move to background (ctrl+z) centmin.sh, you are terminating centmin.sh properly.

    so fix I made in /usr/bin/centmin will be to call centmin.sh in same shell rather than subshell so when you exit (ctrl+c) or move to background (ctrl+z) centmin.sh, centmin.sh and /usr/bin/centmin will both exit

    updating 123.09beta01 for this fix

    so update via cmupdate command and run centmin.sh menu once for updating /usr/bin/centmin

    Code (Text):
    cmupdate
    Saved working directory and index state WIP on 123.09beta01: f8f7605 update nginx & php-fpm upgrade menu routines in 123.09beta01
    HEAD is now at f8f7605 update nginx & php-fpm upgrade menu routines in 123.09beta01
    remote: Enumerating objects: 5, done.
    remote: Counting objects: 100% (5/5), done.
    remote: Compressing objects: 100% (5/5), done.
    remote: Total 5 (delta 0), reused 1 (delta 0), pack-reused 0
    Unpacking objects: 100% (5/5), done.
    From https://github.com/centminmod/centminmod
       f8f7605..cf071ef  123.09beta01 -> origin/123.09beta01
    Updating f8f7605..cf071ef
    Fast-forward
     centmin.sh      | 14 ++++++++++++--
     inc/cpcheck.inc |  7 ++++++-
     2 files changed, 18 insertions(+), 3 deletions(-)
    

    Code (Text):
    cmdir
    ./centmin.sh
    

    fixed version /usr/bin/centmin contents
    Code (Text):
    #!/bin/bash
    pushd "/usr/local/src/centminmod"; . ./centmin.sh
    cleanup_msg() {
      exit 1
    }
    
    trap cleanup_msg SIGHUP SIGINT SIGTERM SIGTSTP
    
     
    Last edited: Apr 20, 2019
  10. pamamolf

    pamamolf Premium Member Premium Member

    3,266
    307
    83
    May 31, 2014
    Ratings:
    +566
    Local Time:
    8:24 PM
    Nginx-1.13.x
    MariaDB 10.1.x
    When i was run cmupdate and then centmin and then exit using 24 i got this:

    Code:
    /usr/bin/centmin: line 3: unction: command not found
    Re running centmin and then exit using 24 all was ok with no error.....

    Don't know if that's normal :)
     
    • Informative Informative x 1
  11. eva2000

    eva2000 Administrator Staff Member

    39,758
    8,769
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +13,494
    Local Time:
    3:24 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ah yes i got that too will look into it, thanks

    though it's normal as pre-fix centmin command won't have function reference until centmin.sh updates /usr/bin/centmin

    edit: believe i fixed that with another update now :)
     
    Last edited: Apr 20, 2019
    • Like Like x 2
..