Very rare failure to expand Foreach-Variable

Alan DeKok aland at
Sun Feb 17 03:53:55 CET 2019

On Feb 16, 2019, at 5:12 PM, Graham Clinch <g.clinch at> wrote:
> Once or twice per day - after many tens of thousands of requests have been successfully processed, a single request will not be processed as expected - freeradius doens't crash and there's no sign of memory corruption - further requests continue to be processed as expected.
> Originally this was seen on v3.0.12, but I have taken one server up to 3.0.x revision 694d088 from git and continue to see this.  Running with -t to disable threading has not helped.
> There's a lot of custom unlang in the configuration.

  That *should* be fine...

> The line missing is '&request:LU-NE-Id := 2' - between "--> &request:LU-NE-Id := 2" and "EXPAND %{map:%{Foreach-Variable-0}}".

  Where does that line come from?  I don't think that the default is to print out bare attribute names to the debug.

> I infer that the value of "&request:LU-NE-Id := 2" is not being returned from the expansion properly and thus map is being passed an empty string.

  Maybe... you'll have to instrument src/main/xlat.c in order to walk through the various expansions to see both their inputs and outputs.

  Also, what's "%{map: ..}" doing?  Is it your custom module, or is it a standard module?

> I've had a glance around tmpl.c and modcall.c but I'm not making much progress working out where the variable value is normally printed.  Can somebody more in touch with the unlang processor point me in the right direction?

  I don't know where it prints out the attribute name like that.  The dynamic expansion code prints out:

	EXPAND input
	     ---> output

  So if the output is wrong, it's long after the string expansion.

  Alan DeKok.

More information about the Freeradius-Users mailing list