Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Combine timers and streams/UDP sockets #657

kristrev opened this Issue · 3 comments

3 participants



I am working on an application were I want to combine a timer event and a UDP socket in the same event loop. I rely on the timer triggering more or less on time, in order to do some cleanup of client connections.

What I discovered is that the UDP socket "blocks" the timer from executing when it is supposed to, because of the loop in udp.c:208. My solution was to do a return after each packet was read, which solved the problem, but is most likely bad for applications requiring high throughput. When looking at the source code of the streams, it seems like they cause the same behavior.

Before I start working on a patch, I wondered if how I use libuv is wrong or if a patch/API change/... is already in the pipeline?



Yeah, the number of "spins" of that loop should have some upper limit. This has actually been fixed for streams already, we'd take a patch for UDP handles as well.


Wasn't that fixed in 738b31e?


Yes, you are correct, there is an upper limit.

It turns out the mistake was all my fault. I created the socket manually and had forgotten to set it to nonblocking :( Thanks for the help and sorry about this!

@kristrev kristrev closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.