Hydra render delegate crash in usdview when updated to 24.05 RC1

Hi,

I’m currently working on getting our Hydra render delegate updated against USD 24.05 RC1. I’m running into crashes while testing the render delegate in usdview with the kitchen scene.

Enabling either PXR_WORK_THREAD_LIMIT=1 or USDIMAGINGGL_ENGINE_ENABLE_SCENE_INDEX=1 causes the crash to disappear.

The render delegate is working fine with many previous versions of USD, including USD23.11

I’m wondering what has changed that I’m not accounting for ? Any hints would be appreciated !

Below a representative stack trace. This is from a debug build, but crashes are also happening in release.

A lot of the crashes seem to be hitting code that was added with this commit: [Hd] Add a per-thread single-entry LRU cache for scene · PixarAnimationStudios/OpenUSD@bce5704 · GitHub

In particular the clearing of the per-thread cache triggers the crashiness.