litespeedtech / litespeedtech/openlitespeed

disconnect between PIDFILE in lswsctrl and systemd service file

Open
#443 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
1.5k
Forks
233
Avg merge
2d 19h
Merged PRs (30d)
5

Description

Hello,

There seems to be "disconnect" between:
[https://github.com/litespeedtech/openlitespeed/blob/master/dist/admin/misc/lshttpd.service.in](https://github.com/litespeedtech/openlitespeed/blob/master/dist/admin/misc/lshttpd.service.in
)and [https://github.com/litespeedtech/openlitespeed/blob/master/dist/bin/lswsctrl](https://github.com/litespeedtech/openlitespeed/blob/master/dist/bin/lswsctrl)
in relation to PIDFILE - service pointing to /var/run/openlitespeed.pid and lswsctl to /tmp/lshttpd/lshttpd.pid

As /tmp doesn't look like correct path to use for systemd service file(something what users might be willing to customize themselves) and thus mitigate it that way, lswsctl might need an update to reference same path?

With that mismatch , calling lswsctrl for restart fails to find correct service pid and basically no real restart happens.

```
# diff -u /usr/local/lsws/bin/lswsctrl /usr/local/lsws/bin/lswsctrl.1
--- /usr/local/lsws/bin/lswsctrl 2025-02-20 14:20:09.759479110 +0200
+++ /usr/local/lsws/bin/lswsctrl.1 2025-02-20 14:20:29.127591178 +0200
@@ -19,7 +19,7 @@

# if the lsws_env is empty or not exist, still need to set the default values
if [ "x$PIDFILE" = "x" ] ; then
- PIDFILE=/tmp/lshttpd/lshttpd.pid
+ PIDFILE=/var/run/openlitespeed.pid
GRACEFUL_PIDFILE=/tmp/lshttpd/graceful.pid
fi

# systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/litespeed.service.d
└─override.conf
Active: active (running) since Thu 2025-02-20 14:20:46 EET; 16min ago
Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 2039199 (litespeed)
CGroup: /system.slice/litespeed.service
├─2039199 "openlitespeed (lshttpd - main)"
├─2039200 "openlitespeed (lscgid)"
├─2039226 "openlitespeed (lshttpd - #01)"
└─2039227 "openlitespeed (lshttpd - #02)"

# /usr/local/lsws/bin/lswsctrl restart
[OK] litespeed: pid=2040285.

# systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/litespeed.service.d
└─override.conf
Active: active (running) since Thu 2025-02-20 14:20:46 EET; 17min ago
Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 2039199 (litespeed)
CGroup: /system.slice/litespeed.service
├─2039199 "openlitespeed (lshttpd - main)"
├─2039200 "openlitespeed (lscgid)"
├─2039226 "openlitespeed (lshttpd - #01)"
└─2039227 "openlitespeed (lshttpd - #02)"

# /usr/local/lsws/bin/lswsctrl.1 restart
[OK] Send SIGUSR1 to 2039199

systemctl status openlitespeed
● litespeed.service - The OpenLiteSpeed HTTP Server
Loaded: loaded (/etc/systemd/system/litespeed.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/litespeed.service.d
└─override.conf
Active: active (running) since Thu 2025-02-20 14:20:46 EET; 17min ago
Process: 2037968 ExecStart=/usr/local/lsws/bin/lswsctrl start (code=exited, status=0/SUCCESS)
Main PID: 2039199 (litespeed)
CGroup: /system.slice/litespeed.service
├─2039199 "openlitespeed (lshttpd - main)"
├─2039200 "openlitespeed (lscgid)"
├─2039226 "openlitespeed (lshttpd - #01)"
├─2039227 "openlitespeed (lshttpd - #02)"
├─2040309 litespeed
└─2040310 "openlitespeed (lscgid)"

# cat /usr/local/lsws/logs/lsrestart.log
Thu Feb 20 02:37:37 PM EET 2025
restart, LSWS running: 0
Thu Feb 20 02:37:53 PM EET 2025
restart, LSWS running: 1
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by comparing the PIDFILE handling in dist/bin/lswsctrl with the PIDFile setting in dist/admin/misc/lshttpd.service.in. Reproduce the reported restart behavior using the shown commands and confirm that the selected PID is the systemd service's main process. Done means the control script and service file use compatible PID paths so restart reaches the running service.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.