1834344 Members
2286 Online
110066 Solutions
New Discussion

Named Pipe Application

 
Rajesh Sankarasubbu
Occasional Contributor

Named Pipe Application

We have a Unix C application Which acts as a Message Handler.Multiple Processes talk to it through a Named Pipe.These processes write request strings to the Named Pipe.The Message Handler reads the Named Pipe and does actions based on the request strings.Processes can be application running in various machines(unix,nt,mainframe) ftp'ing the message string to the Named Pipe.The problem is sometimes the message handler doesnt read the pipe and the pipe size grows,the moment we "touch" the Named pipe , the Message Handler starts reading the requests.Sometimes it so happens that touching the Named pipe simply dont work, we need to re-create the Named pipe.Is there any specific reason as to why this is happening? What happens when multiple writers Write the Message requests at the same time to the Named Pipe ,does it lead it to this behavior? Ours is a production application and the Message Handler handles more than 10,000 requests per day.Sometimes( twice in a month) we encounter this situation and we couldnt really figure out as to why this happens.
Any idea why this strange behavior?
Appreciate all your inputs.
Thanks in advance.
4 REPLIES 4
Dietmar Konermann
Honored Contributor

Re: Named Pipe Application

Hi, Rajesh!

Without knowing precisely how the message handler ensures synchronization, it seems to be impossible to tell anything specific. I personally believe there is some (perhaps small) window for a potential race condition in your handler's design.

You need to check in what state your handler gets stuck, while the pipe contains data. Maybe tracing system calls using "tusc" could be a good starting point.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Steve Steel
Honored Contributor

Re: Named Pipe Application

Hi


I think

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc381abe92dabd5118ff10090279cd0f9,00.html

explains your options well


Steve Steel


Quote of the moment
-------------------
"We are drowning in information but starved for knowledge."
-- John Naisbitt
If you want truly to understand something, try to change it. (Kurt Lewin)
Dietmar Konermann
Honored Contributor

Re: Named Pipe Application

The options in those thread are workarounds for bad coding. Of course finding the bug and fixing the code sounds like a more elegant approach. :-)

Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Frank Slootweg
Honored Contributor

Re: Named Pipe Application

As Dietmar explains, debugging/fixing the code is you best option.

In my experience, multi-platform applications which use named pipes are old-fashioned and often badly-designed, i.e. nowadays they should use a more modern IPC (Inter Process Communication) mechanism, especially if they are (as I understand is the case here), not only inter-process, but also inter-system.

Also I think that "ftp'ing the message string to the Named Pipe" is a Really Bad Idea (tm).