views:

2149

answers:

2

Hi All, We are currently testing a Telecom application over IP. We open a Raw Socket and receives messages from the remote side (msgrate@750+msgs/second approx size of 180 bytes excluding IP).

On top of the Raw socket sits a layer called SCTP (just like TCP) which is indicating every now and then that it is missing some packets. Now, we are running Wireshark on the receive node and we can see that packet in Wireshark.

It looks to me that the receive buffer of the socket is small causing IP(?) to drop messages. However, IP Pegs(netstat -sv) show NO dropped packets. We have tried setting the socket receive queue to 40000 without any success.

I would appreciate any pointers as to what option, if any, of IP layer should we be configuring or is there any specific socket option that we need to set.

Thanks in advance.

+1  A: 

I have a few questions and a few things to think about. 1) Which implementation of SCTP are you using and on which OS. Some SCTP implementations are more robust than others. 2) Is SCTP negatively acknowledging the dropped packets? Search for a gap acks in wireshark. 3) And where you see the dropped packets in wireshark are you sure that these are not retransmissions? 4) Where in the system is wireshark monitoring? If it is not on the same wire as your application then it may be seeing messages which your application doesn't. 5) What exactly is the indication SCTP is giving?

If you believe that the IP socket rx buffer is overflowing then you could consider reducing the size of the SCTP RX window; this is often configurable in sctp stacks. The Rx window limits the amount of data that can be outstanding waiting for acknowledgement and consequently restricts the amount of data which could be in the IP buffer. You could also try raising the priority of your SCTP task so that it more quickly reads messages out of the IP buffers (This may be the easiest thing to try and in my opinion a good thing to do).

Regards

Howard May
We are basically stack vendors so the SCTP implementation is our own. OS is Linux. Yes, wireshark does mention the packets in the Gap Ack block. Wireshark running at the receive node shows the packets but they never reach SCTP. We have a Socket wrapper below the SCTP layer. On SCTP, we print the TSN received and on the Wrapper we have printed the Identification field from the IP header. I can clearly see the IP packet not hitting the Wrapper (and therefore not at SCTP).
Aditya Sehgal
I have increased the txqueuelen and receviequeue len at IP to 10000 each. Tried to increase the socket receive buffer by calling setsockopt to 40000 to no avail. IP pegs dont show any messages dropped. Any ideas would be appreciated.
Aditya Sehgal
What company do you work for?Have you tried raising the priority of your SCTP task and reducing the size of the SCTP rx window yet?Are the lost chunks transmitted in seperate sctp messages or are they bundled?Does the problem happen only at high load?How do you know the lost messages are not hitting the IP wrapper?Regards
Howard May
I work for CCPU (formerly Trillium). Lost chunks are 1 single IP packet (but bundled SCTP chunks). Yes, the problem happens at 750+msg rate. Our Wrapper sits one layer about IP. So, IP gives the packet to our Wrapper (basically queues in the socket receive queue) and our wrapper picks it up. We are sure, by way of debug prints, we are not receiving the packet. We are currently in the process of raising the priority of SCTP Taks. I am not sure what you mean by reducing the size of SCTP rx window.
Aditya Sehgal
an sctp association maintains a finite buffer for holding data received from the peer before it is passed to the SCTP user. This size of this is called the rx_window and is seen in wireshark traces as advertised receive window 'awnd'? The linux kernel implementation uses a default rx window of 128KB.What Linux kernel version are you using? This may be important.
Howard May
our advertised receive window is 12000. any ideas on how to increase the default rx window for linux.
Aditya Sehgal
what version of linux are you using?
Howard May
Sorry, the problem is at a live site. Thats the reason for the delay. Here you go.[root@LABWLSSMC01 trace]# uname -aLinux LABWLSSMC01 2.4.21-37.ELsmp #1 SMP Wed Sep 7 13:28:55 EDT 2005 i686 i686 i386 GNU/Linux
Aditya Sehgal
In addition, I got the Promiscuous mode switched off on the interfaces.
Aditya Sehgal
Are you installing a lksctp module and if so which version?
Howard May
no, we dont use kernel sctp. as i mentioned before, we have our own implementation of SCTP. AFAIK, the packet is not even reaching SCTP
Aditya Sehgal
Hi there, did you manage to resolve the problem? Did raising the priority of SCTP help?
Howard May
nope. However, our implementation had our Wrapper, SCTP, M3Ua and SCCP as a single schedule able entity. I changed that to make the Wrapper a separate thread, SCTP as separate thread and M3ua/sccp as another thread. The situation has improved though we are still facing packet losses.
Aditya Sehgal
A: 

Thanks for your inputs. However, we have been able to "solve" this problem. Earlier, I described how we read messages. Once select returns, we run a loop (to the tune of number of Raw Messages to read which was >1 in our case). 1) we call ioctl(FIONREAD) to find the number of bytes to read; 2) read that many bytes by calling recvfrom 3) send the bytes upto the user 4) go into loop again and call ioctl(FIONREAD) and then repeat the steps

However, at point 4, ioctl(FIONREAD) use to return 0. Our code had a defensive check. It was expecting, a 0 bytes from ioctl(FIONREAD) means that the sender has send an IP header with 0 payload. Therefore, it use to call recvfrom(bytes to read=0) to flush out the IP header lest the select will set again on this.

At time t0, ioctl(FIONREAD) returns 0 as number of bytes to read At time t1, recvfrom(bytes to read=0) is called. Sometimes, between t0 and t1, actual data use to get queued in the socket receive queue and use to get discarded as we were calling recvFrom(bytes=0).

Setting, the number of rawMsgsToRead=1 has "solved" this problem. However, my guess is it will impact our performance. Is their any ioctl call which can differentiate between octets in the queue as 0 and IP header with payload 0

Aditya Sehgal
Glad you have solved your problem. You should create a new question concerning the question you have added about differentiating between octets in the queue as 0 and IP header with payload 0.Regards
Howard May
actually after analyzing it further, I came to the conclusion that calling ioctl(FIONREAD) to find the number of pending bytes is a system call too many. I changed the code to just do a recv (in case of UDP/Raw packets) with the buffer size set to the maximum possible that we are expecting. With that done, I no longer have to worry about IP header with payload 0 scenario. Thanks for your help though. It got me thinking in the right direction.
Aditya Sehgal