Skip to content

The v1.45.0 ThreadPoolExecutor shutdown wait=False change in opentelemetry.sdk.resources.get_aggregated_resources is triggering failures in leaked thread detector in unit tests #5697

Description

@vkruglik-aka

Reference to change:

executor.shutdown(wait=False, cancel_futures=True)

The v1.45.0 ThreadPoolExecutor shutdown wait=False change in opentelemetry.sdk.resources.get_aggregated_resources is triggering failures in leaked thread detector in app unit tests.

The regression introduced in v1.45.0:

  1. Resource.create() call in MeterProvider.init() that spins up a background ThreadPoolExecutor to run resource detectors in parallel.
  2. The 1.44.0 version of the sdk was using the ThreadPoolExecutor in a context manager expression, which joins all of its threads on exit from context.
  3. However, version 1.45.0 doesn't use the context manager and instead shuts down the thread pool explicitly with wait=False, which bypasses the thread join calls resulting in the race condition with the thread leak detection in our test suite.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions