Debug Zeromq Discover Accept Dead loop

Source: Internet
Author: User

Cause: In the group of a classmate said the use of zeromq when a bit of a problem, the problem described as follows "router connect a hundred thousand of client, then the router kill, restart, this time zeromq a thread 99% of the CPU, the card is dead, no longer accept the message." Use GDB tracking found is accept in the dead loop, check Baidu found the following information.

Scenario: A multithreaded server in which each thread executes an event loop. Before the event loop begins, call the Socket/bind/listen listening port, and then add the listener handle (FD) to the Epoll, then start the event loop and execute the epoll_wait. When Epoll_wait returns a valid event, it calls accept to establish a new connection for the listener event, adds the connection handle to Epoll, and calls Read/write for the normal connection for network IO and other processing logic.

Phenomenon: The server process CPU is high, almost every event loop is in accept, the client has timed out.
Cause: Ulimit-n is 65535, the process open FD has exceeded this value, causing the accept to fail to obtain the FD, and at this time the TCP connection three handshake has been established. And because Epoll uses the LT trigger mode, the connection event will be escalated by the epoll, resulting in the so-called "dead loop", in fact, the event loop is not idle, even if there is no actual network IO.

Study.

Debug Zeromq Discover Accept Dead loop

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.