On Fri, May 05, 2017 at 04:05:09PM +0200, Maxim Bourmistrov wrote:
>
> > 5 maj 2017 kl. 15:55 skrev Maxim Bourmistrov <[email protected]>:
> >
> >
> >> 5 maj 2017 kl. 14:41 skrev Hiltjo Posthuma <[email protected]>:
> >>
> >> On Fri, May 05, 2017 at 12:30:56PM +0200, Maxim Bourmistrov wrote:
> >>>
> >>> Hey,
> >>> on OpenBSD 6.0-stable I have following configuration for relayd:
> >>>
> >>> ————snip———————
> >>> interval 10
> >>> timeout 1200
> >>> prefork 15
> >>> log all
> >>> ——————————————————
> >>>
> >>> Respective login.conf to spawn more relayd procs:
> >>>
> >>> relayd:\
> >>> :maxproc-max=31:\
> >>> :maxproc-cur=15:\
> >>> :openfiles=65536:\
> >>> :tc=daemon:
> >>>
> >>>
> >>> With config options above moved to a 6.1 creates following:
> >>>
> >>> relayd starts but brings up no more that 3 relay-processes.
> >>> Also after start up it refuses to do any checks configured (in my simple
> >>> test I used check tcp)
> >>>
> >>> [mxb-test]-[12:21:41]# relayctl sh su
> >>> Id Type Name Avlblty Status
> >>> 1 relay rabbitmq active
> >>> 1 table rabbitmqpool:5672 empty
> >>> 1 host 10.5.96.8 unknown
> >>> 2 table rabbitmqfallback:5672 empty
> >>> 2 host 10.5.96.9 unknown
> >>>
> >>>
> >>> Changing ’prefork’ from 15 to 3 makes it work.
> >>>
> >>> Is this a bug?
> >>>
> >>> Br
> >>>
> >>
> >> Hey,
> >>
> >> This is a random guess since you haven't posted the whole config, but I
> >> think
> >> it has bitten me too sometime:
> >>
> >> Do you have the global options such as prefork defined before your
> >> relays and routes or not?
> >>
> >> The order of the global options matter. If the global options are set after
> >> the table they are not initialized on the tables and can actually crash
> >> relayd.
> >> This is because the health checking uses a different prefork value and
> >> checks
> >> the "wrong" amount.
> >>
> >> I'm not sure, but I think it is not a bug: it is documented in
> >> relayd.conf(5).
> >>
> >> Thinking about it: would it be acceptable if `relayd -n` shows a warning if
> >> global options are defined in the wrong order? I can write the patch for it
> >> if it makes sense.
> >>
> >> I hope this helps you in some way,
> >>
> >> --
> >> Kind regards,
> >> Hiltjo
> >
> 8< snip snip >8
>
Hey,
Here is a (rough) patch/idea to check if global options are used after
non-global options such as tables, routes, redirects etc. This makes sure a
value of `timeout`, `prefork` etc that are set on tables are are not different
from the health-checking (which could crash relayd at run-time).
It has bitten a few people and me :)
The patch will show an error in this case when checking the config with
`relayd -n`.
Please let me know if it makes sense.
Above is the thread from @misc. Below is the (rough) patch:
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index 57ab789db8f..c768b657d69 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -375,7 +375,18 @@ sendbuf : NOTHING {
}
;
-main : INTERVAL NUMBER {
+main : /* empty */
+ {
+ if (conf && (conf->sc_rdrcount || conf->sc_tablecount ||
+ conf->sc_protocount || conf->sc_relaycount ||
+ conf->sc_routercount || conf->sc_routecount)) {
+ yyerror("global options used after non-global
options");
+ YYERROR;
+ }
+ }
+ main_l;
+
+main_l : INTERVAL NUMBER {
if ((conf->sc_conf.interval.tv_sec = $2) < 0) {
yyerror("invalid interval: %d", $2);
YYERROR;
--
Kind regards,
Hiltjo