What's the best way to restart the OLS server and make sure new configs are applied to all requests

gilles

Active Member
#1
Doing a graceful restart does not kill/restart old openlitespeed/lsphp processes as far as I can see.

This is what I am using:
> service lsws stop; sleep 5; service lsws status; killall lsphp; service lsws status; service lsws start; service lsws statusIt works most of the time but wondering if there is a better way.
 

Cold-Egg

Administrator
#2
Hi,

A graceful restart should works.

If this is about PHP, you either do "killall lsphp" or wait until the PHP process timeout due to PHP is set to Detached Mode by default.
 

gilles

Active Member
#3
Well somehow that does not work for me. I just made a change to the headers, did the graceful restart, run killall lsphp, reloaded the non-cached checkout page I was seeing the header issue on, and the issue was still there. I tried killall lsphp another time, reload, and still the same. Only after I ran the above sequence did the issue go away.
 

gilles

Active Member
#4
Maybe this is due to this error I see in the server error.log:
2020-11-04 20:30:18.026220 [NOTICE] [serverIP:52833:HTTP2-69#_AdminVHost] [STDERR] PHP Warning: socket_connect(): Host lookup failed [-10003]: Unknown server error in /usr/local/lsws/admin/html.open/lib/ControllerBase.php on line 506
2020-11-04 20:30:18.026408 [NOTICE] [serverIP:52833:HTTP2-69#_AdminVHost] [STDERR] cmd restart
failed to connect to server! socket_connect() failed: Unknown server error
I have not figured out what's causing this.
 

gilles

Active Member
#5
Not sure if it's related, but I sometime have two openlitespeed sets of processes:
> service lsws status
lshttpd.service - OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/lshttpd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2020-11-04 20:21:27 PST; 13min ago
Process: 290166 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 290185 (litespeed)
CGroup: /system.slice/lshttpd.service
├─290185 openlitespeed (lshttpd - main)
├─290212 openlitespeed (lscgid)
├─290235 openlitespeed (lshttpd - #01)
├─290236 openlitespeed (lshttpd - #02)
├─290237 lsphp
├─290551 openlitespeed (lshttpd - main)
├─290574 openlitespeed (lscgid)
├─290615 openlitespeed (lshttpd - #01)
└─290616 openlitespeed (lshttpd - #02)
 

gilles

Active Member
#7
Most likely unrelated to my problem, but a bit surprised to see a case-sensitive string comparison for 'uds://' when the documentation says to use 'UDS':
Code:
        public static function getCommandSocket($cmd)
        {
                $ADMSOCK =  $_SERVER['LSWS_ADMIN_SOCK'];
                if ( strncmp( $ADMSOCK, 'uds://', 6 ) == 0 ) {
I'm guessing the socket prefix is correctly hardcoded somewhere, so that's why it works.
 

gilles

Active Member
#8
I think I fixed it. The /usr/local/lsws/admin/tmp/ directory was missing read permissions for group/other. Once I fixed that, $_SERVER['LSWS_ADMIN_SOCK'] got its proper value.

I'm not sure how the permission problem happened, could have been my doing. Does OLS have a "fix permissions" tool?
 
Top