7.3.4. Environment Variables which affect LN clients

LN_MANAGER

TCP/IP address of a listening ln-manager for the client to connect to. usually this will be automatically provided by the ln-manager in the default environment for each process. it is in the form of <HOST>:<PORT> where <HOST> can either be an IPv4-address in dotted-decimal notation or a domain-name that can be resolved by the local name resolver. PORT is the numeric listening TCP port of the manager to connect to.

this env-var is only used when a client is constructed via ln_init() or ln::client() and no manager address was explicitly provided either via function-arguments or the --ln-manager command-line parameter. (or when NULL is passed for the ln_manager-argument to ln_init_to_manager()).

LN_DEBUG

when set to 1 ln-clients will output internal debug messages to stdout.

For the corresponding ln_manager behavior under the same environment variable name, see the manager-side LN_DEBUG entry in Environment Variables which control the LNM.

LN_PTHREAD_STACK_SIZE

Optional explicit stack size for pthreads created by libln on Linux.

If unset, libln leaves the pthread stack size at the platform default. If set, the value is passed to pthread_attr_setstacksize() before creating libln threads. The value is interpreted as bytes by default. K, M, and G suffixes are accepted, for example 512K or 2M.

On Linux, if pthread creation fails while the system is in heuristic overcommit mode and Committed_AS is already above CommitLimit, libln retries once with a smaller 512 KiB stack and writes a warning to stderr if that retry succeeds. This retry is only a fallback for the failed thread creation; it does not change the default stack size used by later thread creation attempts.

The failure diagnostics also print RLIMIT_MEMLOCK and VmLck from /proc/self/status. This is useful for processes that call mlockall(MCL_CURRENT | MCL_FUTURE): future pthread stack mappings then count against the process’ locked-memory limit, and pthread_create() can fail if a new stack would exceed that limit. VmLck is the amount of memory currently locked by the process.

If the hard locked-memory limit is already high enough, the soft limit for an LN-started process can be raised in the LN config:

process robotkernel
add set_resource_limits: max locked memory=inf

To apply this to every process in an LN instance, use default_resource_limits in the instance section instead:

instance
add default_resource_limits: max locked memory=inf

The LN resource limit setting can only raise a soft limit up to the inherited hard limit. If the hard limit is too low, raise it through the operating system, for example in /etc/security/limits.conf or a file under /etc/security/limits.d/ on systems using pam_limits:

@robotics soft memlock unlimited
@robotics hard memlock unlimited

The limits.conf(5) syntax is <domain> <type> <item> <value>. Its memlock item is specified in KiB, and unlimited/infinity are accepted on typical Linux systems. Existing sessions and already running managers or daemons usually need to be restarted before changed login limits are inherited. See limits.conf(5) and pam_limits(8) for details.

LN_DEBUG_TO_FTRACE

when set to 1 ln-clients will output internal debug messages to /sys/kernel/debug/tracing/trace_marker independent of the setting of LN_DEBUG.

LN_FTRACE

when set to 1 ln-clients will output messages to /sys/kernel/debug/tracing/trace_marker before and after writing/reading to/from a topic shared memory.