# Epoll's file descriptor and kernel object lifetime semantics

DevFeed: [Epoll's file descriptor and kernel object lifetime semantics](<https://devfeed.tech/articles/epoll-is-fundamentally-broken-2-2-38961.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2017-03-20-epoll-is-fundamentally-broken-22>)

Author: Marek

Published: 2017-03-19T23:00:00Z

Content type: article

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [IO](<https://devfeed.tech/topics/io.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [cleanup](<https://devfeed.tech/tags/cleanup.md>), [file](<https://devfeed.tech/tags/file.md>), [issue](<https://devfeed.tech/tags/issue.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [object](<https://devfeed.tech/tags/object.md>)

## AI overview

This article examines epoll's handling of file descriptors and underlying kernel objects. It explains that epoll subscription lifetime is tied to the kernel object rather than the file descriptor, so closing a descriptor may leave subscriptions active and allow events to be reported for a closed descriptor.

## Source excerpt

Epoll is fundamentally broken 2/2 I/O multiplexing part #4 Previous articles in this series: - The history of the Select(2) syscall - Select(2) is fundamentally broken - Epoll(2) is fundamentally broken In this post we'll discuss the second argument on why the is broken. The problem is best described in an LWN comment by Foom: And epoll certainly has a HUGE misdesign in it, that anyone who actually understood what a file descriptor is should've seen coming.