c - net_ratelimit message in kernel log when creating multiple TCP connection in NONBLOCKING mode -
i've c program tries poll devices in network , if devices available tries read value them. when no devices present running of application creates following message in kernel log. there no other warning/alert messages in log below message. (even after disabling ratelimit using net.core.message_cost=0
)
net_ratelimit: xx callbacks supressed
and @ same time application broadcasts messages on network starts fail in send system call returning einval
. once stop polling tcp
client udp broadcast
application runs fine.
the system run ramfs
based system running 3.14 series kernel rt_preempt
patch applied. i've written sample application mimics same behavior original application when start 5 process in background. (note more 4 process triggers it). below sample client code.
#include <sys/types.h> #include <sys/socket.h> #include <sys/select.h> #include <sys/time.h> #include <sys/ioctl.h> #include <arpa/inet.h> #include <netinet/in.h> #include <unistd.h> #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define chk_null(x) if ((x)==null) exit (1) #define chk_err(err,s) if ((err)==-1) { perror(s); exit(1); } #define chk_ssl(err) if ((err)==-1) { err_print_errors_fp(stderr); exit(2); } int sfd; void openprotocol(const char *hostname) { int sfd = socket(pf_inet, sock_stream, 0); chk_err(sfd, "socket"); struct sockaddr_in address; memset(&address, 0, sizeof(address)); address.sin_family = pf_inet; address.sin_addr.s_addr = inet_addr(hostname); address.sin_port = htons(502); int opt = 1; int result = ioctl(sfd, fionbio, &opt); if (result == -1) { close(sfd); chk_err(result, "ioctl"); } result = connect(sfd, (struct sockaddr*)&address, sizeof(address)); if (result == -1 && errno != einprogress) { close(sfd); chk_err(result, "connect"); } fd_set fdlist; fd_zero(&fdlist); struct timeval tm; tm.tv_sec = 1; tm.tv_usec = 0; result = select(sfd + 1, null, &fdlist, null, &tm); if (result == 0) { printf ("tcp/ip connection error!\n"); close(sfd); } if (result == -1) { close(sfd); chk_err(result, "select"); } } int main(int argc, char *argv[]) { char *base_addr = "192.168.1."; unsigned short startaddr = 21; if ( argc < 3) { fprintf (stderr, "please provide number of ip , wait period\n"); exit(exit_failure); } unsigned int no_of_ip; if (sscanf (argv[1], "%u", (unsigned int*)&no_of_ip) != 1 ) { fprintf (stderr, "scan of number of device failed\n"); exit(exit_failure); } unsigned int wait_period; if (sscanf (argv[2], "%u", (unsigned int*)&wait_period) != 1) { fprintf (stderr, "scan of wait period failed\n"); exit(exit_failure); } char full_addr[100]; char last_part[10]; while (1) { (int = startaddr; < (startaddr + no_of_ip); i++) { memset(&full_addr[0], 0, sizeof(full_addr)); memset(&last_part[0], 0, sizeof(last_part)); strncat (full_addr, base_addr, sizeof(full_addr)); snprintf (last_part, sizeof(last_part), "%u", i); strncat (full_addr, last_part, sizeof(full_addr)); openprotocol(full_addr); usleep(wait_period * 1000); } } return 0; }
application takes input number of devices , wait time. run 5 instances of above application via shell script 128
device number , 5
wait time (5 ms).
now question.
why getting
net_ratelimit
messages when running application (5
instances). tried disablingnet_ratelimit
settingnet.core.message_cost
0
can't find in kernel log othernet_ratelimit
messages.why unrelated application (
udp broadcast
client) gettingeinval
when trying send broadcast. happens when polling application runs. killing polling application broadcast client returns normal.
ps: not better title line, if 1 has better title line please suggest/edit ;-).
after upgrading kernel 4.1 series see reason message. actual root cause below message
neighbour: arp_cache: neighbour table overflow
then noticed i'm adding entries arp cache crossed 1024 default limit. after fixing issue of callback supressed messages stopped. guess bug in 3.14 series did not provide actual cause of call supressed
messages.
Comments
Post a Comment