Overwrite existing USD Files fails sometimes

Hey everyone,

In our pipeline we would sometimes like to overwrite an existing USD file so we don’t need to do any path remapping whatsoever, everyone just gets the change immediatetly.

DCCs like Houdini often fail to overwrite a usd file as it seems to be used by some other process. The same goes for overwriting or deleting it byt hand on a filesystem level.

How does USD handle situations like this? If a usd stage is opened somewhere does it lock the files?

If USD is not the issue, how we can avoid it or work around it?

This is unfortunately a deceptively complex answer.

  1. It really depends on your OS whether you default to exclusive file handles or not. I believe windows does and it sounds like that’s the first issue you’re hitting.

  2. The second issue is that binary usd files are memory mapped in. So changing the file underneath an open layer is undefined behaviour , and in most situations will cause a crash or gibberish. Usda files on the other hand are completely memory loaded.

The way a lot of folks handle this is by having a sync step outside of USD that then explicitly triggers a USD reload. This sync step maybe triggered manually by a user (say by clicking an update button in the DCC ) or by having a file watcher.

2 Likes