Skip to content

Busy loop on IO.select #23

@adsr

Description

@adsr

Hello, I noticed knife ssh (a Chef tool) sometimes pegs a core. I traced the issue back to this library, which sometimes falls into a busy IO.select loop here (via the parent's loop_forever):

readers, writers, = IO.select(readers, writers, nil, wait)

This happens when the readers and writers arrays are both empty.

Here are the syscalls being executed which clearly shows the issue:

[pid 25954] getpid()                    = 25954
[pid 25954] pselect6(1, [], [], NULL, {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
[pid 25954] getpid()                    = 25954
[pid 25954] pselect6(1, [], [], NULL, {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)
[pid 25954] getpid()                    = 25954
[pid 25954] pselect6(1, [], [], NULL, {tv_sec=0, tv_nsec=0}, NULL) = 0 (Timeout)

I haven't dug into this enough to recommend a fix. Not sure if Chef is mis-using this library or if it's purely a library bug, but either way it seems the library shouldn't get into this state.

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