Recvfrom problem record

Source: Internet
Author: User
Tags syslog

<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">    偶然情况下recvfrom函数出现了不正常的情况,目前还没有复现。</span>


Post part of the code and the information in the log price.

struct timeval tv_out;tv_out.tv_sec = 120;tv_out.tv_usec = 0;setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &tv_out, sizeof(tv_out)); udp_media_cond = 1;        while(udp_media_cond)    {        memset(buf, 0, sizeof(buf));        memset(temp, 0, sizeof(temp));        len = recvfrom(sockfd, buf, sizeof(buf), 0, (struct sockaddr *)&client_addr_from, &fromlen);                if (0 >= len)        {            syslog(LOG_DEBUG, "DEBUG:recv data error!");            syslog(LOG_DEBUG, "DEBUG:uid is '%s', port is '%d'.", uid, port);            if (EAGAIN == errno)            {                syslog(LOG_DEBUG, "DEBUG: EAGAIN!");                //return 0;            }        }                buf[len] = '\0';}


Printing in logs:

Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG: EAGAIN!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.
More than a dozen pieces of data are printed at the end.

Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf rsyslogd-2177: imuxsock begins to drop messages from pid 2218 due to rate-limitingOct 27 12:26:22 32f32c8c-8c75-4249-bbf2-afa068de9aaf rsyslogd-2177: imuxsock lost 176521 messages from pid 2218 due to rate-limiting


Normally, these prints are not available.
Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG: EAGAIN!
It took 2 minutes to receive no data.

Crazy print

Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:16 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060110', port is '5500'.
It is abnormal. Unless the data is accepted, the data accepted each time is empty.


This thread finally died. After a while

Oct 27 12:26:22 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:22 32f32c8c-8c75-4249-bbf2-afa068de9aaf rsyslogd-2177: imuxsock begins to drop messages from pid 2218 due to rate-limitingOct 27 12:26:29 32f32c8c-8c75-4249-bbf2-afa068de9aaf rsyslogd-2177: imuxsock lost 3408 messages from pid 2218 due to rate-limitingOct 27 12:26:29 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:recv data error!Oct 27 12:26:29 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG:uid is '00060001', port is '5501'.Oct 27 12:26:29 32f32c8c-8c75-4249-bbf2-afa068de9aaf server_debug:[2218]: DEBUG: EAGAIN!
The main thread does not receive any data, or the client does not send the data (the possibility is very small), and the thread has no printing.



Recvfrom problem record

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.