Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
06-12-2014, 01:36 AM
|
#1
|
LQ Newbie
Registered: Sep 2010
Posts: 21
Rep:
|
Strange behavior from epoll in RHEL 6.5
Hello,
Saw some strange behavior from epoll with RHEL 6.5 Kernal ( 2.6.32-431.el6.x86_64).
I have created 2 threads one for reading data from socket and other for sending data on to socket. During my initialization i am creating my epoll FD using "epoll_create1(0)" and after that i will start adding my socket descriptors to it for poll.
While adding my socket to poll list, i am doing
epoll_ctl(m_epoll_fd, operation, socket_fd, &event)
m_epoll_fd : one i created using "epoll_create1(0)"
operation : EPOLL_CTL_ADD or EPOLL_CTL_DEL
socket_fd : Socket FD i created after Socket connection is established
event : "struct epoll_event" with my own data epoll_event.data.ptr and epoll_event.events is "EPOLLIN".
What i am seeing after all this is, after closing the connection and after removing the Socket FD from poll list, i am still getting "EPOLLIN" events for this socket. Also it is not once but varies, sofar i observed highest number of "EPOLLIN" events i received after closing and removing the FD from poll list is 14times.
My question is, is there any know issue in epoll of RHEL 6.5?
Or do i need to do something extra or i am doing something wrong?
Regards,
Ananth
|
|
|
06-12-2014, 02:23 PM
|
#2
|
Senior Member
Registered: Apr 2009
Posts: 1,880
Rep:
|
The event cache could cause the behavior.
If you use an event cache or store all the fd's returned from epoll_wait(2), then make sure to provide a way to mark its closure dynamically (ie- caused by a previous event's processing). Suppose you receive 100 events from epoll_wait(2), and in eventi #47 a condition causes event #13 to be closed. If you remove the structure and close() the fd for event #13, then your event cache might still say there are events waiting for that fd causing confusion.
One solution for this is to call, during the processing of event 47, epoll_ctl(EPOLL_CTL_DEL) to delete fd 13 and close(), then mark its associated data structure as removed and link it to a cleanup list. If you find another event for fd 13 in your batch processing, you will discover the fd had been previously removed and there will be no confusion.
|
|
|
06-16-2014, 12:12 AM
|
#3
|
LQ Newbie
Registered: Sep 2010
Posts: 21
Original Poster
Rep:
|
Thanks Nini, let me try this out.
|
|
|
All times are GMT -5. The time now is 12:20 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|