Skip to content
This repository was archived by the owner on May 4, 2018. It is now read-only.
This repository was archived by the owner on May 4, 2018. It is now read-only.

Zero-delay timers are executed immediately #1427

@orborde

Description

@orborde

If, during a timer callback, I schedule a timer with a timeout of 0, it will get run immediately, without the uv_loop bothering to process other non-timer pending events. If, as in the attached example, my timer callback schedules another timeout=0 timer, uv_run will get stuck forever executing my callback again and again, even if I pass UV_RUN_ONCE.

Example: https://gist.github.com/orborde/fe0d6e2747a7dd725b33
Note that uv_run never returns.

EXPECTED BEHAVIOR:
The libuv event pump should keep a separate queue of newly-scheduled timer events to (possibly) be fired on the next run through the main event loop (or the next call to uv_run if UV_RUN_ONCE is specified). It should not immediately execute a newly-scheduled timer, even if it is immediately due to be fired.

Original mailing list post:
https://groups.google.com/d/msg/libuv/uaN1o4IAWW8/WHGrB-IPsY0J

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions