Welcome! Log In Create A New Profile

Advanced

Admin socket server state and MAINT flag issues

Posted by Dennis Jacobfeuerborn 
Dennis Jacobfeuerborn
Admin socket server state and MAINT flag issues
April 10, 2017 09:10PM
Hi,
i'm currently playing with the values that the admin socket return when
the "show servers state" command is issued and I noticed to things:

1. When using and abstract namespace socket as address on a server line
then the srv_addr "field" will be empty which technically isn't a
problem but the documentation doesn't seem to mention how exactly fields
are delimited. Example:

....
5 sites-front-ssl 1 clear 2 0 1 1 63797 1 0 2 0 0 0 0
....
(notice the two spaces after "clear")

In my first attempt at parsing the output i used white-space as a
delimiter which failed for this particular server line. Once I used one
single space character as a delimiter the parsing worked fine.
I would probably be good to document this explicitly to make parsers
more robust. Alternatively one could use white-space as a delimiter and
maybe output fields that have not content as "-".

2. The server administrative state flags are defined like this:

enum srv_admin {
SRV_ADMF_FMAINT = 0x01,
SRV_ADMF_IMAINT = 0x02,
SRV_ADMF_MAINT = 0x23,
SRV_ADMF_CMAINT = 0x04,
SRV_ADMF_FDRAIN = 0x08,
SRV_ADMF_IDRAIN = 0x10,
SRV_ADMF_DRAIN = 0x18,
SRV_ADMF_RMAINT = 0x20,
};

Shouldn't the SRV_ADMF_MAINT value include the CMAINT flag and thus
actually have a value of 0x27?

Regards,
Dennis
Willy Tarreau
Re: Admin socket server state and MAINT flag issues
April 11, 2017 08:20PM
Hi Dennis,

On Mon, Apr 10, 2017 at 09:05:13PM +0200, Dennis Jacobfeuerborn wrote:
> Hi,
> i'm currently playing with the values that the admin socket return when
> the "show servers state" command is issued and I noticed to things:
>
> 1. When using and abstract namespace socket as address on a server line
> then the srv_addr "field" will be empty which technically isn't a
> problem but the documentation doesn't seem to mention how exactly fields
> are delimited. Example:
>
> ...
> 5 sites-front-ssl 1 clear 2 0 1 1 63797 1 0 2 0 0 0 0
> ...
> (notice the two spaces after "clear")

Hmmm that's not cool, we need to address this.

> In my first attempt at parsing the output i used white-space as a
> delimiter which failed for this particular server line. Once I used one
> single space character as a delimiter the parsing worked fine.
> I would probably be good to document this explicitly to make parsers
> more robust. Alternatively one could use white-space as a delimiter and
> maybe output fields that have not content as "-".

Yes I agree, I was thinking the same. You may have the same problem when
the address uses the unix family. There are some places in the code (logs
and/or "show sess") where we simply report "unix@" or "abns@", I think it
would be even better since it would allow to better know the current
family and still be compatible with the format that needs to be reinjected.

> 2. The server administrative state flags are defined like this:
>
> enum srv_admin {
> SRV_ADMF_FMAINT = 0x01,
> SRV_ADMF_IMAINT = 0x02,
> SRV_ADMF_MAINT = 0x23,
> SRV_ADMF_CMAINT = 0x04,
> SRV_ADMF_FDRAIN = 0x08,
> SRV_ADMF_IDRAIN = 0x10,
> SRV_ADMF_DRAIN = 0x18,
> SRV_ADMF_RMAINT = 0x20,
> };
>
> Shouldn't the SRV_ADMF_MAINT value include the CMAINT flag and thus
> actually have a value of 0x27?

I don't know, it depends on your config, and I don't know the output format
by memory to be honnest :-) CMAINT normally stands for "set to maintenance
by configuration" which is the "disabled" directive on the server. Some of
these flags are needed to let the new process detect what part of the config
has changed and what part differs between the old config and the state file
in order to decide which one to use (the last config change has precedence
since you want to support reloads to update your config). I seem to remember
that not all flags are dumped, but I could say bullshit here.

Regards,
Willy
Sorry, only registered users may post in this forum.

Click here to login