[SR-Users] mq_fetch and while loops

Alex Balashov abalashov at evaristesys.com
Tue Jun 28 23:41:40 CEST 2011


On 06/28/2011 05:36 PM, Watkins, Bradley wrote:

> I'm having an issue trying to use the construct show in the module documentation.
>
> The docs show:
> while(mq_fetch("myq"))
> {
>     xlog("$mqk(myq) - $mqv(myq)\n");
> }
>
> And I'm doing essentially the same thing (differently named mqueue, but otherwise identical), but invariably I get this in the logs:
> ERROR:<core>  [action.c:1388]: ERROR: runaway while (559, 28): more then 100 loops

I reported this back in October:

    http://lists.sip-router.org/pipermail/sr-users/2010-October/065740.html

A fix was committed to the master branch almost immediately:

    http://lists.sip-router.org/pipermail/sr-dev/2010-October/009499.html

I requested that it be backported into the 3.1 branch in May and it was 
done:

    http://lists.sip-router.org/pipermail/sr-dev/2011-May/011132.html

However, I don't know that it's made it into the tarballs yet.  You can 
get the 3.1 branch with the fix by doing this:

    git clone git://git.sip-router.org/sip-router -b 3.1

Otherwise, here's the workaround I was using before:

       while(mq_fetch("myq")) {
          ...

          if(!defined $mqk(myq))
             break;

           ...
        }

Cheers,

-- Alex

-- 
Alex Balashov - Principal
Evariste Systems LLC
260 Peachtree Street NW
Suite 2200
Atlanta, GA 30303
Tel: +1-678-954-0670
Fax: +1-404-961-1892
Web: http://www.evaristesys.com/



More information about the sr-users mailing list