Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated LayerManager to purge cached self on scene reset #1760

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

jonjondev
Copy link
Contributor

This change to the AL plugin's LayerManager was authored to solve a multi-threaded-related crash when using a somehow "valid" and "alive" MObjectHandle for the LayerManager cache. The change ensures that the cache is cleared on each new scene, resolving the issue.

I have also gone ahead and made similar changes to the shared LayerManager as requested in PR #1734. Let me know if there are any changes you think would be appropriate for the shared implementation - I've tried to base it on what was already there.

@kxl-adsk kxl-adsk added adsk Related to Autodesk plugin al Related to AnimalLogic plugin core Related to core library labels Oct 19, 2021
Copy link

@kxl-adsk kxl-adsk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one request for a change in comments. Additionally, I'm curious about this multi-threaded-related crash that you were getting. Do you happen to have any more info? Call-stack maybe?

if (layerManagerHandle.isValid() && layerManagerHandle.isAlive()) {
MObject mobj { layerManagerHandle.object() };
if (!mobj.isNull()) {
fn.setObject(mobj);
return static_cast<MayaUsd::LayerManager*>(fn.userNode());
} else {
MGlobal::displayInfo("LayerManager::findNode cache got null MObject");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These traces doesn't tell much to the end-user, please remove them.

@fabal
Copy link
Contributor

fabal commented Oct 19, 2021

Here's the stack we got with that issue:

Thread 1 (Thread 0x7fffc69d8c40 (LWP 89031) "maya.bin"):
#0  0x00007ffff4f7a0a5 in Autodesk::Maya::OpenMaya20200000::MFnDependencyNode::userNode (this=this@entry=0x7ffffffd2590, ReturnStatus=ReturnStatus@entry=0x0) at /local/S/Maya_2020PFix_DI/src/Maya/src/OpenMaya/API/APInodeArch/MFnDependencyNode.cpp:1639
#1  0x00007fff86ae3115 in AL::usdmaya::nodes::LayerManager::findOrCreateManager (dgmod=dgmod@entry=0x0, wasCreated=wasCreated@entry=0x0) at /scratch/aloysb/dev/repos/maya-usd/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/LayerManager.cpp:387
#2  0x00007fff86afc0b1 in AL::usdmaya::nodes::ProxyShape::trackEditTargetLayer (this=0xfebd0b0, layerManager=0x0) at /scratch/aloysb/dev/repos/maya-usd/plugin/al/lib/AL_USDMaya/AL/usdmaya/nodes/ProxyShape.cpp:762
#3  0x00007fff86b0b85e in pxrInternal_v0_20_pxrReserved::TfNotice::_DelivererWithSender<pxrInternal_v0_20pxrReserved::TfWeakPtr<AL::usdmaya::nodes::ProxyShape>, pxrInternal_v0_20pxrReserved::TfWeakPtr<pxrInternal_v0_20pxrReserved::UsdStage>, void (AL::usdmaya::nodes::ProxyShape::*)(pxrInternal_v0_20pxrReserved::UsdNotice::StageEditTargetChanged const&, pxrInternal_v0_20pxrReserved::TfWeakPtr<pxrInternal_v0_20pxrReserved::UsdStage> const&), pxrInternal_v0_20pxrReserved_::UsdNotice::StageEditTargetChanged>::_InvokeListenerMethod (this=<optimized out>, this=<optimized out>, noticeType=..., sender=<optimized out>, notice=..., listener=0xfebd0b0) at /film/tools/packages/usdBase/0.20.11_0.1/python-2.7/AL_boost-1.70/include/pxr/base/tf/notice.h:745

@fabal fabal force-pushed the J-Mo63/register-scene-reset-notice branch from 92f5c27 to 70cbf10 Compare October 20, 2021 02:52
@kxl-adsk kxl-adsk merged commit 9431832 into Autodesk:dev Oct 21, 2021
@jonjondev jonjondev deleted the J-Mo63/register-scene-reset-notice branch October 21, 2021 22:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adsk Related to Autodesk plugin al Related to AnimalLogic plugin core Related to core library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants