HdCycles is easy to hang loading larger .usda files

Does not hang without setting PXR_PLUGINPATH_NAME, i.e., using the usdview’s GL renderer.

The .usda file is not very large, just 5+ MiB.

hdCycles.dll!tbb::task::wait_for_all() Line 791 C++
hdCycles.dll!tbb::internal::task_group_base::wait() Line 158 C++
[External Code]
tbb_debug.dll!tbb::interface7::internal::isolate_within_arena(tbb::interface7::internal::delegate_base & d, __int64 reserved) Line 1038 C++
[External Code]
hdCycles.dll!ccl::BVHEmbree::build(ccl::Progress & progress, ccl::Stats * stats, RTCDeviceTy * rtc_device_) Line 166 C++
hdCycles.dll!ccl::CPUDevice::build_bvh(ccl::BVH * bvh, ccl::Progress & progress, bool refit) Line 273 C++
> hdCycles.dll!ccl::Geometry::compute_bvh(ccl::Device * device, ccl::DeviceScene * dscene, ccl::SceneParams * params, ccl::Progress * progress, unsigned __int64 n, unsigned __int64 total) Line 241 C++
[External Code]
hdCycles.dll!tbb::internal::function_task<std::function<void __cdecl(void)>>::execute() Line 981 C++
tbb_debug.dll!tbb::internal::custom_schedulertbb::internal::IntelSchedulerTraits::local_wait_for_all(tbb::task & parent, tbb::task * child) Line 517 C++
tbb_debug.dll!tbb::internal::arena::process(tbb::internal::generic_scheduler & s) Line 156 C++
tbb_debug.dll!tbb::internal::market::process(rml::job & j) Line 703 C++
tbb_debug.dll!tbb::internal::rml::private_worker::run() Line 266 C++
tbb_debug.dll!tbb::internal::rml::private_worker::thread_routine(void * arg) Line 220 C++
[External Code]

By changing “std::string deviceType = Device::string_from_type(DEVICE_CPU);” to DEVICE_CUDA, I can load the .usda by running usdview from command line, but “Reopen stage” still hangs in detatchedTask.cpp > Work_EnsureDetachedTaskProgress():

                    while (true) {
                        // Process detached tasks.
                        dispatcher.Wait();
                        // Now sleep for a bit, and try again.
                        using namespace std::chrono_literals;
                        std::this_thread::sleep_for(50ms);
                    }

The callstack contains only this much info.

I can debug throught appController.py > _reopenStage without hanging.

session.cpp

  scene_lock.unlock();
  scene->load_kernels(progress);
  scene_lock.lock(); // Might hang.