Richard Bucker

OpenBSD Restarting Relayd

Posted at — Oct 7, 2021

It seems really strange to me that I cannot find this post… So I had to write it myself.

The “OpenBSD way” is reading manpages not googling.

Unfortunately the manpages are not clear on the subject.

If you’re running a server with a combination of static pages and an appserver then you are likely running relayd and httpd in some combination. Personally I had great hopes that this was a silver bullet but unfortunately…

do not copy/paste example code and think it’s production ready

so as I continued to through my configuration it’s just not clear what the answer is and so this is my recommendation.

You’re running relayd and every once in a while it just dies. It could be relayd reload or it could be httpd reload that cascades when relayd detects that httpd is down and does not properly reconnect. There is a note in the relayd or relayd.conf manpage about what happens when it perceives that a httpd or appservice connection is down. Something like it is signaled down and will not try again… but then something about exiting if all the endpoints are down.

This is actually a complicated set of circumstances because in some cases you really want it to crash and in others you want carp to signal a takeover by a peer and there are others when you just want relayd to retry to connect to the endpoint and continue running.

Right now I have only one worst case. Relayd stops running and that’s the worst case. So I’ll start there.

(you’ll have to fill in the gaps but it’s all there for reading)

UPDATE - it’s not all unicorns… seems that running relayd from inside freedt and in the foreground means that relayd is getting the wrong login classification… daemon instead of relayd. In my case I needed to increase the openfiles value in /etc/login.conf.

Not terrible but not fun.

UPDATE - Found this comment in the code: “Allow the maximum number of open file descriptors for this login class (which should be the class “daemon” by default)” which tells me that there is no daemon “relayd”.

UPDATE - and then I found an example that seems to work-ish

# usermod -L relay _relay