Skip to content

macOS build (via Xcode) generates a hang warning when run with the Thread Performance Checker #1961

Description

@jpetrie

Building an app with Jolt v5.5.0 (from the release tag) and running with the latest Xcode (26.4 - 17E192) with the Thread Performance Checker diagnostic enabled produces a hang warning diagnostic at runtime:

Thread running at User-interactive quality-of-service class waiting on a lower QoS thread running at Default quality-of-service class. Investigate ways to avoid priority inversions

The warning points to the dispatch_semaphore_wait() call inside Semaphore::Acquire() - the call stack is below. I'm updating the physics system on the main thread. Apple's documentation suggests ensuring the Quality-of-Service value for the job threads is the same, although I don't think this is straightforward since Jolt's using std::thread for the worker threads and there is no portable way for it to change that setting. You'd need to get the native_handle and use the pthread API to change the QoS, or something - I'm not that familiar with pthread, honestly. Jolt probably shouldn't assume the thread running the system is running at User-Interactive, either, I'm guessing.

I'm not sure exactly why I just started seeing this, I updated Xcode recently and then updated Jolt to get a version with the is_trivial fix, and I think the new Xcode might default to enabling the thread diagnostic now? It's easy enough to simply toggle the diagnostic off but it would be nice to be able to use it without seeing warnings I have to ignore.

The call stack from the PhysicsSystem site looks like:

JPH::Semaphore::Acquire(unsigned int) at .../Vendor/Source/Jolt/Jolt/Core/Semaphore.cpp:121
JPH::JobSystemWithBarrier::BarrierImpl::Wait() at .../Vendor/Source/Jolt/Jolt/Core/JobSystemWithBarrier.cpp:154
JPH::JobSystemWithBarrier::WaitForJobs(JPH::JobSystem::Barrier*) at .../Vendor/Source/Jolt/Jolt/Core/JobSystemWithBarrier.cpp:227
JPH::PhysicsSystem::Update(float, int, JPH::TempAllocator*, JPH::JobSystem*) at .../Vendor/Source/Jolt/Jolt/Physics/PhysicsSystem.cpp:625

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions