VxWorks Network Buffer Fills Causing Loss of CommunicationHardware: CompactRIO>>Controllers>>cRIO-9012, CompactRIO>>Controllers>>cRIO-9014, CompactRIO>>Controllers>>cRIO-9072, CompactRIO>>Controllers>>cRIO-9073, CompactRIO>>Controllers>>cRIO-9024, CompactRIO>>Controllers>>cRIO-9022, CompactRIO>>Controllers>>cRIO-9023, CompactRIO>>Controllers>>cRIO-9025, CompactRIO>>Chassis (Backplanes)>>cRIO-9076, CompactRIO>>Chassis (Backplanes)>>cRIO-9075, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9602, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9641, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9611, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9612, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9601, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9642, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9631, Reconfigurable I/O (RIO)>>NI Single-Board RIO>>sbRIO-9632
Problem: My LabVIEW program running on a Real-Time target opens a network port for TCP or UDP communication. This target then becomes unresponsive to network communication. Why is this happening, and how can I fix it? Solution: This KnowledgeBase covers a behavior of the VxWorks operating system involving a known limitation to how it handles network buffer allocation. Most networking problems with LabVIEW Real-Time Targets are not related to this issue but are due to High Priority Loops forcing the operating system to stop network communication to insure loop execution. Common solutions to that issue is to check CPU usage is not 100% and if possible slow the high priority loops and see if the issue is resolved. The following is a detailed discussion of the VxWorks buffer limitation, its causes, and possible workarounds.
Opening a TCP or UDP port in LabVIEW opens that port for both reading and writing. In rare cases, an open port that is only used for writing may accumulate incoming data (often UDP multicast packets) in the network receive buffer. This is an issue because VxWorks uses a single, shared buffer (divided into a fixed number of clusters of different sizes) for all network communication. If all clusters of a certain size become full, the network stack will hang and the Real-Time target will experience symptoms such as:
To determine if you are experiencing this issue, perform the following steps:
![]() Two tested workarounds that prevent the network receive buffer from overflowing are: Read in Parallel from the Open Port Using a TCP Read or UDP Read function in parallel with the Write function removes packets from the network receive buffer. A Read option needs to occur for each packet in the buffer, so the timeout ms function input (especially the default value of 25 seconds) is a good option for controlling timing. This workaround is best suited for continual write processes, and was benchmarked to only increase CPU load by .65% on a cRIO 9012. ![]() Open, Read, Close Closing the TCP or UDP port clears out the network receive buffer. Therefore, an "open, read, close" process can be used to ensure unwanted packets do not accumulate. Opening and closing actions can be decimated to occur every 5 or 10 writes, but this increases the time that packets could accumulate. This workaround is best suited to occasional write operations, as benchmarking indicated that a closed port cannot be reopened for up to 450 μs. The Workarounds.zip folder attached below contains LabVIEW code that demonstrates both workarounds. Related Links: KnowledgeBase 4LRA4IQ0: What Operating System is my Real-Time Controller Running and Why? KnowledgeBase 3M87HMD7: Usage of Console Out Switch on CompactRIO, Single-Board RIO, cFP-21xx, and cFP-22xx Controllers LabVIEW 2011 Help: UDP Read Function LabVIEW 2011 Help: TCP Read Function Attachments:
Report Date: 05/14/2012 Last Updated: 08/27/2014 Document ID: 5XD9A3YL |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||


