Changeset 3aa925f


Ignore:
Timestamp:
May 18, 2017 12:53:31 PM (4 months ago)
Author:
www-data <www-data@…>
Branches:
master, release_9.5
Children:
2fa689e
Parents:
03360a5
git-author:
Dimitar Misev <misev@…> (05/17/17 12:52:50)
git-committer:
www-data <www-data@…> (05/18/17 12:53:31)
Message:

ticket:1542 - fix shutdown of rasserver

Summary: rasmgr wasn't checking properly if a rasserver has already completed shutdown or not, so it was always waiting until the 3s timeout; this patch fixes the issue.

Test Plan: manually tested

Reviewers: vmerticariu

Reviewed By: vmerticariu

Differential Revision: http://codereview.rasdaman.org/D404

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • bin/start_rasdaman.sh.in

    r65a6ebb r3aa925f  
    6464DEFAULT_RASCONTROL_LOGIN=rasadmin:d293a15562d3e70b6fdc5ee452eaed40
    6565
    66 # sleep time to let rasmgr establish before spawning servers
    67 WAIT_FOR_CHILDREN=1
    68 
    6966# error messages:
    7067ERROR_PARAM="ERS001 Error: illegal parameter: $1"
     
    120117
    121118# --- start servers: -------------------------------------------------
    122 
    123 # allow process to establish
    124 sleep $WAIT_FOR_CHILDREN
    125119
    126120# check if rasmgr's pid is actually running; if not, exit with an error.
     
    172166
    173167# do a rasql query test to check if rasdaman has started properly
     168sleep 0.1 || sleep 1
    174169@bindir@rasql -q 'select version()' --quiet -p $RASMGR_PORT > /dev/null 2>&1
    175170if [ $? -ne 0 ]; then
  • rasmgr_x/src/serverrasnet.cc

    r65a6ebb r3aa925f  
    222222    if (this->started)
    223223    {
    224         //Remove the process fromt he process table if it has died.
     224        //Remove the process from the process table if it has died.
    225225        int status;
    226226        waitpid(this->processId, &status, WNOHANG);
     
    399399        // wait until the server process is dead
    400400        boost::int32_t cleanupTimeout = SERVER_CLEANUP_TIMEOUT;
    401         bool isProcessAlive = true;
    402         while (cleanupTimeout > 0 && isProcessAlive)
     401        while (cleanupTimeout > 0 && isProcessAlive(this->processId))
    403402        {
    404403            usleep(SERVER_CHECK_INTERVAL);
    405404            cleanupTimeout -= SERVER_CHECK_INTERVAL;
    406             isProcessAlive = (kill(this->processId, 0) == 0);
    407405        }
    408406
    409407        // if the server is still alive after SERVER_CLEANUP_TIMEOUT, send a SIGKILL
    410         if (isProcessAlive)
     408        if (isProcessAlive(this->processId))
    411409        {
    412410            if (kill(this->processId, SIGKILL))
     
    598596}
    599597
    600 }
     598bool ServerRasNet::isProcessAlive(pid_t pid) const
     599{
     600    int status;
     601    return waitpid(pid, &status, WNOHANG) == 0;
     602}
     603
     604}
  • rasmgr_x/src/serverrasnet.hh

    r65a6ebb r3aa925f  
    212212    const char* convertDatabRights(const UserDatabaseRights& dbRights);
    213213
     214    bool isProcessAlive(pid_t pid) const;
    214215};
    215216
  • relblobif/lockfile.cc

    r1b40e87 r3aa925f  
    106106        if (unlink(lockFilePath.c_str()) == IO_ERROR_RC)
    107107        {
    108             LWARNING << "failed deleting lock file (" << lockFilePath << "): " << strerror(errno);
     108            if (access(lockFilePath.c_str(), F_OK) != IO_ERROR_RC)
     109            {
     110                // lock file still exists, but cannot be removed; perhaps it was locked by another process?
     111                LWARNING << "failed deleting lock file (" << lockFilePath << "): " << strerror(errno);
     112            }
     113            else
     114            {
     115                // it was already deleted by another process probably, nothing to do
     116            }
    109117        }
    110118        fd = INVALID_FILE_DESCRIPTOR;
Note: See TracChangeset for help on using the changeset viewer.