[OpenSIPS-Users] FIFO very fragile
Vlad Paiu
vladpaiu at opensips.org
Wed May 11 15:51:19 CEST 2011
Hello Brett,
A well formed MI command should end with two '\n\n' characters. When you do
echo -e ":address_dump:my_fifo\n\n"
,your MI command ends with three '\n', because echo adds an extra \n at
the end, unless you use the -n parameter.
So what happens is that OpenSIPS successfully processes your
address_dump MI command, and then reads the third \n.
It treats it as an empty MI command, and attempts to block and read the
second \n signaling the end of the MI command, and there it gets stuck.
Regards,
--
Vlad Paiu
OpenSIPS Developer
On 05/09/2011 07:40 PM, Brett Nemeroff wrote:
> Hello List,
> So I've been doing some testing with the mi_fifo and found that it
> appears to be really fragile. Here's what I've done:
>
> mkfifo /tmp/my_fifo
> cat /tmp/my_fifo&
> echo -e ":address_dump:my_fifo\n\n" > /tmp/opensips_fifo
> *returns*
> 200 OK
> 48 <1.2.3.4,2, 0, 0, NULL, NULL>
> ** cat process ends
> cat /tmp/my_fifo&
> echo -e ":address_dump:my_fifo\n\n" > /tmp/opensips_fifo
> ** nothing
>
> At this point, I can't make the fifo work again until I restart
> opensips. If I detach from the fifo (kill the cat, so to speak), and
> reattach it doesn't work. Nothing seems to make it responsive again.
> At first I though something was horribly broken, but then I removed
> one of my \n from the fifo command and now it works "as expected". Two
> new-lines shouldn't break the fifo, right?
>
> Thanks!
> -Brett
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110511/76d58786/attachment.htm>
More information about the Users
mailing list