Project

General

Profile

Actions

Feature #3072

closed

Print specific config value, particularly the PID, to assist with packaging

Added by herbmillerjr about 3 years ago. Updated about 3 years ago.

Status:
Invalid
Priority:
Normal
Category:
-
Target version:
-
ASK QUESTIONS IN Forums:
No

Description

There have been some issue surrounding the PID when packaging for Gentoo. I wanted to know if we could make adjustments upstream that might help. The attached patch adds a command line switch that will print a specific config value instead of the whole thing so that maintainers don't have to re-parse the config for the PID.

Also, it seems the early call to `getrandom()` causes the server to hang the boot process because it happens before the filesystem is remounted read/write (Bug #598468). Is there any harm in moving the call to `li_rand_reseed()` to later in the startup process, like in the patch? This would allow the config to be printed without hanging the boot process.

Reference:
https://bugs.gentoo.org/626688
https://bugs.gentoo.org/598468


Files

print_config_value_move_rand.patch (4.3 KB) print_config_value_move_rand.patch Add option to print specific config value and moves li_rand_reseed() herbmillerjr, 2021-03-10 13:58
Actions #1

Updated by gstrauss about 3 years ago

  • Category deleted (core)
  • Status changed from New to Invalid
  • Target version deleted (1.4.x)

You have combined multiple requests. Please do not do that.

There have been some issue surrounding the PID when packaging for Gentoo. I wanted to know if we could make adjustments upstream that might help.

Please post in the forums to ask questions before submitting patches for things that might be end-user mistakes instead of issues in lighttpd. What problem are you trying to solve? You have not sufficiently described the problem.

Why are you not using server.pid-file? The pid will then be ... wait for it ... easily readable from the file.

If not using that, any service management, such as systemd or daemontools, can run lighttpd -D (to keep lighttpd in the foreground) and then you can use the service management tools to send signals to the lighttpd pid.

In your patch for printing config, you only print the value if the value is a string. That is a major limitation and unsuitable to even be considered.
(BTW, you have also misspelled "speccific" (sic) and "teh" (sic))

.

Regarding the call to getrandom(), did you test your patch? Does it work? (Odds are "no" and "no" from my reading of the patch.)

Is there any harm in moving the call to `li_rand_reseed()`

General answer: yes there is possible harm. If you do not know what the code does and why, then it is dangerous to move it. The initial call to li_rand_reseed() that you moved in your patch should not do anything. Additionally, the place that you moved it to should not have any perceivable difference with the original, even if the initial call did have an effect.

The code in lighttpd defers seeding the random number generators.

However, that is probably not your problem. If you are using any TLS module, the TLS module initialization is more likely the place where the server is hanging waiting for the system to have sufficient entropy available to continue. This is independent from li_rand_reseed().

Actions #2

Updated by gstrauss about 3 years ago

https://bugs.gentoo.org/598468 is from 2016. Is this still an issue for you? If so, what version of lighttpd are you running? (and why would a competent developer omit such basic information from any post?)
See lighttpd commit 28c8fec4 from Dec 2016 for li_rand_reseed()

https://bugs.gentoo.org/626688

- Could lighttpd just have a default if one isn't set? This would eliminate the need for LIGHTTPD_PID to appear in /etc/conf.d at all. I'm not sure if not writing one out is by design, so I'll ask upstream.

Yes, it is by design: e.g. for "read-only" filesystems. Not every old or historical system had /run, or is Linux.

You want a pid-file, configure one.
You want to force a value for the pid-file? Then force one from a final extra include. See configuration syntax := available since lighttpd 1.4.46 (#2799)

Failing all that, and failing to use a service manager like systemd or daemontools, you could still have the script which starts lighttpd to then log the lighttpd pid to (yet another) alternate location.

Actions #3

Updated by gstrauss about 3 years ago

Linux-specific, and requires to be root or the user under which lighttpd is running (and assumes lighttpd running on port 443):
netstat -lntp 2>/dev/null | grep :443 | grep lighttpd | awk '{print $7}' | cut -d/ -f1

Actions

Also available in: Atom