Skip to content
This repository

Greenlet-based event I/O Framework for Python

branch: master

Handle fd reuse during epoll callback processing

There is a comment to this effect, but file descriptors can get reused.
If a read event and write event were triggered for a fd and the read
callback unregistered the fd (because the remote closed) and then
attempted a reconnect and the fd was reused when registerd, the write
callback was still getting invoked in the same iteration of event
handling. However, the callback wasn't intended for a disconnected

The bug was observed when attempting to reconnect dropped SSL
connections in a try/except block. It was causing the event hub
to freeze up indefinitely.

The event hub now tracks an ID for file descriptors and checks that the
ID at the start of even processing for a fd is the same after doing read
callback handling. If the ID changes the write callback is not invoked.
latest commit 887eca7cd5
Christian Wyglendowski dowski authored
Octocat-spinner-32 diesel Handle fd reuse during epoll callback processing
Octocat-spinner-32 doc A start on API docs
Octocat-spinner-32 examples Resurrected an old chat example
Octocat-spinner-32 tests Move the zmq service test to tests/protocol
Octocat-spinner-32 .gitignore Gitignore autogenerated palm protobuf code
Octocat-spinner-32 .travis.yml Add Travis-CI configuration
Octocat-spinner-32 LICENSE license update
Octocat-spinner-32 Setup updated.
Octocat-spinner-32 Makefile Fleshing out a test suite.
Octocat-spinner-32 README.rst Take tutorial out of README.
Octocat-spinner-32 TODO more todo crap
Octocat-spinner-32 TOTEST Update (for now) rough testing notes until 2.X testing plan is finali…
Octocat-spinner-32 Handle fd reuse during epoll callback processing
Octocat-spinner-32 tox.ini Add tox.ini for tox

Why Diesel?

You should write your next network application using diesel.

Thanks to Python the syntax is clean and the development pace is rapid. Thanks to non-blocking I/O it's fast and scalable. Thanks to greenlets there's unwind(to(callbacks(no))). Thanks to nose it's trivial to test. Thanks to Flask you don't need to write a new web framework using it.

It provides a clean API for writing network clients and servers. TCP and UDP supported. It bundles battle-tested clients for HTTP, DNS, Redis, Riak and MongoDB. It makes writing network applications fun.

Read the documentation, browse the API and join the community in #diesel on freenode.


Diesel is an active project. Your best bet to stay up with the latest at this point is to clone from github.:

git clone git://

Once you have a clone, cd to the diesel directory and install it.:

pip install .


python install


python develop

For More Information

Documentation and more can be found on the diesel website.

Something went wrong with that request. Please try again.