Skip to content

[BUG] OpenImageIO's default thread pool initialization has a data race. #4922

@kwasimensah

Description

@kwasimensah

Describe the bug

A clear and concise description of what the bug is. What happened, and
what did you expect to happen instead.

OpenImageIO's default thread pool initialization seems to have a data race.
In OpenImageIO 2.4.8 (and it seems to still be the same in upstream main)

thread_pool::thread_pool
-> thread_pool::Impl::Impl
-> thread_pool::Impl::resize
-> thread_pool::Impl::set_thread
-> starts a new thread using the lambda f
-> that lambda references thread_pool::Impl::q before thread_pool::Impl's constructor has finished on the main thread

Full TSAN error with proprietary parts of the stack removed beloe

OpenImageIO version and dependencies

2.4.8

Evidence

  • Error messages (paste them here exactly)
  • Screenshots (if helpful)
  • Example input: If the problem only happens with certain image files, please
    attach the smallest image you can make that reproduces the problem.

IF YOU ALREADY HAVE A CODE FIX: There is no need to file a separate issue,
please just go straight to making a pull request.

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