[OpenSIPS-Users] FIFO very fragile
Brett Nemeroff
brett at nemeroff.com
Tue May 10 06:02:05 CEST 2011
On Mon, May 9, 2011 at 7:28 PM, Dave Singer <dave.dorasinger at gmail.com>wrote:
> Brett,
>
> In your perl app are you starting and forking/threading the read before
> print FIFO ":uptime:reply_fifo\n";
> ?
Dave,
I tried all sorts of ways. I'm pretty sure my problem comes down to some
failicy in how I'm performing my open statement to write to the opensips
fifo.
My first attempt was linearly:
1. Open Reader
2. Open Writer
3. Write fifo command to writer (/tmp/opensips_fifo)
4. Loop over Reader filehandle until I get something
Because of the way fifos work, this naturally blocks on the reader and never
makes it to the writer. This is verified by administering an "echo" to the
fifo with a valid command and everyone wakes up (and works properly)
Second attempt was forking
1. Open Reader
2. Sleep 5 seconds
3. Fork
4. Fork Opens Writer
5. Fork writes to writer (/tmp/opensips_fifo)
6. Reader in loop looking for data from filehandle
This also blocks on the reader. From what I can see, it doesn't appear that
anything ever gets written (at least not properly) to /tmp/opensips_fifo.
I've tried opening it with > and >. I've also tried explicit sysopen calls
for write only and a few other variants. None of them worked
Next I tried the above scenario, but I wrote another perl script that did
nothing but open /tmp/opensips_fifo and wrote to it.. That didn't work
either. That was running on another terminal altogether. So no backgrounding
funny business here..
Last attempt was forking with a system call.
1. Open Reader
2. Fork
3. Fork executes system call to `echo` command to /tmp/opensips_fifo
4. Reader in loop looking for data from filehandle
5. Reader returns result from opensips *SUCCESS*
That last variant works over and over... Of course, this issue above is
notably a different issue than my original posting which is really about the
fragility of the fifo itself. If given improper commands it tends to lock up
(just the fifo, nothing else).
If you have any ideas on what to do here, I'd appreciate it. :)
Thanks!
-Brett
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110509/fe164a2f/attachment.htm>
More information about the Users
mailing list