Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760627AbZIPXoP (ORCPT ); Wed, 16 Sep 2009 19:44:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760585AbZIPXoN (ORCPT ); Wed, 16 Sep 2009 19:44:13 -0400 Received: from smtp-gw3.mailanyone.net ([208.101.34.33]:37100 "EHLO smtp-gw3.mailanyone.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1760229AbZIPXoM (ORCPT ); Wed, 16 Sep 2009 19:44:12 -0400 X-Greylist: delayed 1131 seconds by postgrey-1.27 at vger.kernel.org; Wed, 16 Sep 2009 19:44:12 EDT From: "Gilad Benjamini" To: Subject: epoll and closed file descriptors Date: Wed, 16 Sep 2009 16:22:55 -0700 Message-ID: <023c01ca3724$9f90fcb0$deb2f610$@com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Aco3JJ3A4zG/sL37Rnq1Eo9A0f/YsQ== Content-Language: en-us Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 29 I am running repeatedly into a scenario where epoll notifies userland of events on a closed file descriptor. I am running a single thread application, on a single CPU machine so multiple threads isn't the issue. A sample set of events that I have seen - File descriptor (13) for a socket is closed - epoll_wait returns with no events. - Several epoll related calls happen - More than 20 seconds after the "close", epoll_wait finds an event on fd 13 with EPOLLIN|EPOLLERR|EPOLLHUP. - epoll_wait continues to report this event Running kernel 2.6.24. Some technical problems are preventing me from trying a newer kernel at the moment. One more thing worth mentioning: the application uses libcurl, leading to a situation where the file is closed before the descriptor was removed from the epoll descriptor. The code should be able to handle that AFAIK. Any ideas would be appreciated. Gilad -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/