python2.6 epoll.modify failed to unregister events ?

Z

Ziliang Chen

Hi Guys,
I have encountered an epoll issues. On the server side, I use epoll.poll() to wait for events, when there is a socket which has EPOLLIN/EPOLLUP events, I first try to read the socket (I did this coz it says EPOLLIN ready, I might think it has some data in its recv queue). After reading 0 length data, the code thinks the peer shutdown its socket, so it notifies the epoll that it doesn't care any events for this socket anymore by calling epoll.modify(sock, 0). But this call seems failed to function, coz when I did another round of epoll.poll(), the socket is still ready for EPOLLUP. My understanding for epoll Linux interface is that it should work if we pass no eventswhen calling epoll_ctl.


Steps to reproduce this problem. Open up two consoles, one for client, one for server. Input the following code in the two consoles by the following order.[/QUOTE]
client
---
Server
----
ep.poll() [(4, 1)]
sock, peer_addr = accept_socket.accept()
ep.register(sock, select.EPOLLIN)
Client
---6


Server
---
ep.poll() [(6, 1)]
sock.recv(1024) 'ahello'
sock.shutdown(socket.SHUT_WR)

Client
---

Server
----
ep.poll() [(6, 17)]
sock.recv(1024) ''
ep.modify(sock, 0) <= I am saying, i don't care any events for the sock
ep.poll() <= but epoll still return the event for this sock [(6, 16)]
ep.poll() [(6, 16)]
ep.modify(sock, 0)
ep.poll()
[/QUOTE]
[(6, 16)]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top