Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server quits quietly with inaccessible log dir when not running in foreground #402

Open
jonesman opened this issue Jan 28, 2023 · 2 comments

Comments

@jonesman
Copy link
Contributor

When launching solanum for the first time, I hadn't looked at setting up the log directory yet, and it didn't have the right permissions.
The server said it was going into the background and then the process disappeared. When running it in the foreground, I get an error message about the permissions, but when running it normally I don't.
I saw in the code it goes into the background first and then sets up the logfiles, so that would explain that.

@jillest
Copy link
Contributor

jillest commented Jan 28, 2023

Solanum indeed has a rather simplistic daemonization mechanism: at an early point in startup, it forks and the parent exits. The only improvement compared to daemon(3) is a message with the daemon's process ID. If this is worth improving, I suggest doing it like atheme, which opens a pipe between parent and daemon to allow the parent to wait until the daemon is fully initialized (the daemon also keeps stdin/stdout/stderr to the terminal until that point). Postponing the fork may lead to various issues since APIs like BSD kqueue and threads do not work properly across a fork.

Perhaps many installations don't actually use daemonization any more (e.g. with systemd unit files), so this may not be particularly relevant.

@jonesman
Copy link
Contributor Author

jonesman commented Jan 30, 2023

Hello, thank you for the reply, I'm not very familiar or should say not all familiar with the technique of forking, the pipes and file handles and all the associated stuff unfortunately.
So I don't know if they way it works at the moment is the only way to keep it simple as you said, or do it the way that you suggested. Didn't mean to sound like I knew better, it was just out of a lack of knowledge probably. Maybe it's not really worth looking at for them/you, and running it in the foreground I could clear it up for myself pretty quickly, but it did cause a few minutes of confusion which I thought didn't have to be there.

If I can add a suggestion, why not check the logfile permissions very early, so the user can definitely be notified. At least for me that's one of the classic hickups or oversights I make when first setting up a "service" by hand.

Cheers, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants