[ejabberd] strange registration error

Konstantin Khomoutov flatworm at users.sourceforge.net
Thu Nov 12 19:57:41 MSK 2009

On Thu, 12 Nov 2009 07:17:02 -0800
Jan Koum <jan.koum at gmail.com> wrote:

> >> on freebsd i am using jot(1) -- seems to work so far:
> >> # common control function
> >> RANDOM=`jot -r 1 1 100`
> > This is over-engineered. Just use the pid of the shell process with $$.
> > It's guaranteed to be unique at the time of call.
> the issue is that you want to be limited in the set of values you can use.
> badlop said:
> *But a problem appears if you periodically call this script: each time you
> call it, ejabberdctl connects to the long-lasting ejabberd node with a
> different node name. Those names are stored temporarily in the node, and RAM
> consumption increases very slowly. Imagine 1 call every minute * a few weeks
> of rrdtool callings --> problem.*
> which is why i am using a random number between 1 and 100.  jot(1) is hardly
> over-engineering:)

On the other hand, PIDs are also rotated, they just span a more lengthy
vector of values (about 64k on a typical Unix system).
The upside using PIDs is that the chance of a race condition is zero.

More information about the ejabberd mailing list