Skip to content

linux-v4l2: udev monitor thread spins if poll keeps returning POLLERR/POLLHUP #1280

Closed

Description

@zackees

Part of #1273. A, rare error path.

plugins/linux-v4l2/v4l2-udev.c.h:113-126: the udev monitor thread calls poll(fds, 2, 1000) and continues whenever POLLIN is not set. If the netlink fd ever reports a persistent POLLERR/POLLHUP/POLLNVAL, poll returns immediately every time and the thread spins with no wait. Normal operation is fine.

Fix: on POLLERR|POLLHUP|POLLNVAL, log once and either reopen the monitor with a backoff or exit the thread.

Test: feed the loop a closed or errored fd (a socketpair with the peer closed) and check that it exits or backs off instead of looping.

Activity

  1. zackees commented on Oct 17, 2026

    @zackees
    MemberAuthor

    Claiming. Plan: on POLLERR|POLLHUP|POLLNVAL the udev thread logs once and exits (or reopens with a backoff if that's cheap) instead of looping; RED is a cmocka test driving the loop with a socket whose peer is closed, asserting it stops instead of spinning.

  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimedAn agent or person has claimed this; check the claim comment before starting

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions