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

Undoing a group action can crash Maya #1481

Closed
dj-mcg opened this issue Jun 10, 2021 · 17 comments
Closed

Undoing a group action can crash Maya #1481

dj-mcg opened this issue Jun 10, 2021 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@dj-mcg
Copy link
Collaborator

dj-mcg commented Jun 10, 2021

Describe the bug
When undoing a group action for multiple models, Maya will crash if the rotation manipulator (and possibly others?) was active during grouping.

Steps to reproduce
Steps to reproduce the behavior:

  1. Open up a USD scene containing at least 2 USD models
  2. Select the 2 models
  3. Hit 'e' to display the rotation manipulator
  4. Hit 'ctrl-g' to group the models
  5. Hit 'ctrl-z' to undo the group
  6. Observe the crash

Expected behavior
No crash.

Attachments
If applicable, add screenshots, sample files, etc to help explain your problem.

Specs (if applicable):

  • 64-bit Linux
  • Maya 2022
  • Maya USD commit SHA [dev @ 04a3317]
  • Pixar USD commit SHA [dev @ e52a6ce]

Additional context
Stack Trace:

#6 Tf_DiagnosticHelper::IssueFatalError(char const*, ...) const ()+0x10e @0x415ae from /pixar/ws/trees/danmcgarry/ufe1_s/inst/fedora-gcc64-opt/mayapkg_2022.base/plugin/../lib/../../pxr/lib/libtf.so
#7 Usd_IssueFatalPrimAccessError(Usd_PrimData const*) ()+0x7d @0x1a67ed from /pixar/ws/trees/danmcgarry/ufe1_s/inst/fedora-gcc64-opt/mayapkg_2022.base/plugin/../../pxr/lib/libusd.so
#8 UsdObject::GetStage() const ()+0x70 @0x182730 from /pixar/ws/trees/danmcgarry/ufe1_s/inst/fedora-gcc64-opt/mayapkg_2022.base/plugin/../../pxr/lib/libusd.so
#9 MayaUsd_v0::ufe::UsdTransform3dMayaXformStackHandler::editTransform3d(std::shared_ptr<Ufe_v2::SceneItem> const&, Ufe_v2::EditTransform3dHint const&) const ()+0x198 @0x3ddb88 from /pixar/ws/trees/danmcgarry/ufe1_s/inst/fedora-gcc64-opt/mayapkg_2022.base/plugin/../lib/libmayaUsd.so
#10 MayaUsd_v0::ufe::UsdTransform3dPointInstanceHandler::editTransform3d(std::shared_ptr<Ufe_v2::SceneItem> const&, Ufe_v2::EditTransform3dHint const&) const ()+0x9c @0x3e5cac from /pixar/ws/trees/danmcgarry/ufe1_s/inst/fedora-gcc64-opt/mayapkg_2022.base/plugin/../lib/libmayaUsd.so
#11 Ufe_v2::Transform3d::editTransform3d (item=..., hint=...)+0x12c @0x506cc at /home/S/jenkins/workspace/ufe-full-linux/ufe/src/transform3d.cpp:205
#12 TmanipRotateContext::updateRotateManips(bool, bool) ()+0xfe9 @0x215489 from /dist/sw/maya/2022.base/lib/libManips.so
#13 TmanipRotateContext::updateManipPivot(TclientServer*, TserverMsg const&) ()+0x1a6 @0x2165f6 from /dist/sw/maya/2022.base/lib/libManips.so
#14 TclientServer::notifyClients(TserverMsg const&) ()+0x1c2 @0x17bbe2 from /dist/sw/maya/2022.base/lib/libFoundation.so
#15 TdelayedClientServer::notifyClients(TserverMsg const&) ()+0x198 @0x177c58 from /dist/sw/maya/2022.base/lib/libFoundation.so
#16 Tmodel::notifyToolPivotModified(bool) ()+0x29 @0x6f7269 from /dist/sw/maya/2022.base/lib2/libDataModel.so
#17 Tmodel::UfeSelectionChangedCB(Tclient*, TclientServer*, TserverMsg const&) ()+0x46 @0x6ed6c6 from /dist/sw/maya/2022.base/lib2/libDataModel.so
#18 TclientServer::notifyClients(TserverMsg const&) ()+0x1c2 @0x17bbe2 from /dist/sw/maya/2022.base/lib/libFoundation.so
#19 TdelayedClientServer::forceAllNotifications() ()+0xba @0x17775a from /dist/sw/maya/2022.base/lib/libFoundation.so
#20 TgroupCmd::undoIt() ()+0x112 @0x4f1942 from /dist/sw/maya/2022.base/lib2/libShared.so
#21 TcommandContainer::undoIt() [clone .localalias] ()+0x3b @0xa844b from /dist/sw/maya/2022.base/lib2/libCommandEngine.so
#22 TundoManager::undo(unsigned int) ()+0x10e @0xa6c6e from /dist/sw/maya/2022.base/lib2/libCommandEngine.so
#23 TundoAction::doCommand(TargList&) ()+0xc9 @0xa7ec9 from /dist/sw/maya/2022.base/lib2/libCommandEngine.so
#24 Mel_Command_Dispatch(SphNode*) ()+0x264 @0x98124 from /dist/sw/maya/2022.base/lib2/libCommandEngine.so

@dj-mcg dj-mcg added the bug Something isn't working label Jun 10, 2021
@HamedSabri-adsk
Copy link
Contributor

Hi @dj-mcg, I followed the steps and can't reproduce this on my side:

Ungroup_

I am on Windows now but will try this on my Linux later today to see if I can reproduce it. I highly doubt this is platform specific.

In the callstack that you have posted, it looks like a stale object trying to access to a stage. Hence the crash. I don't see the line numbers so it is a bit hard to follow. It would be helpful if you could attach a video to show the issue in action.

Also note that there are currently a few issues with Grouping that I have logged internally.

@santosd
Copy link
Collaborator

santosd commented Jun 11, 2021

I also tested this on Windows and on Linux and so far I have not been able to reproduce the issue. @dj-mcg are you able to reproduce this from a new stage with a few standard prims or is it specific to a file you are using?

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 11, 2021

Hmmm, this was in a USD scene I had saved. Let me try starting from scratch...

@santosd
Copy link
Collaborator

santosd commented Jun 11, 2021

I was able to reproduce a crash with grouping and undo then attempting to move some prims in the 2022 release, but not with the latest changes I have on my end which will be in the next release so it is possible it is something that was there in 2022 but has since been fixed:
Here is how I was able to get Maya 2022 to crash:

  1. Create a New Stage.
  2. Create two prims (e.g. cubes).
  3. Select the two prims.
  4. Enable move tool.
  5. Group the selection.
  6. Undo and notice the objects are not highlighted then attempt to move them and Maya will crash.

Is it possible that is what you were seeing? This issue is no longer present with the latest changes.

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 11, 2021

Here is our repro (thanks to Grace!)

  1. open a new empty maya file
  2. Create -> Universal Scene Description (USD) -> Stage with new Layer
  3. Right click on the proxy shape -> Add New Prim -> Cone (or another prim or xform)
  4. Right click on the proxy shape -> Add New Prim -> Cone (or another prim or xform)
  5. Select the 2 new prims and create a group by pressing ctrl+g
  6. Click on one of the newly created prims
  7. Trigger the transform manip by pressing w or e or r
  8. Ctrl+Z to undo the selection
  9. Ctrl+Z to undo the group -> crash

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 11, 2021

BTW I just pulled the latest changes but I'm still building them. I'll try once it's done

Edit: Unfortunately they are doing systems maintenance at the office so I can't log in until Monday. The crash does sound similar to the repro @santosd shared. I'm on 64 bit linux btw

@santosd
Copy link
Collaborator

santosd commented Jun 14, 2021

Hi @dj-mcg,

I tested the exact steps provided by Grace and I was still not able to hit the crash with the latest changes. Let me know, what the results are on your end with the latest changes.

Cheers,

David Santos

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 14, 2021

Strange - I'm still crashing with the latest mayaUsd changes as of Friday. I'll build against USD Release to see if it's something there...

@HamedSabri-adsk
Copy link
Contributor

@dj-mcg I just tried the exact steps and like David can't reproduce it on my side.

As a FYI, there are two assertions being thrown when undoing the group command. This is a known issue and we have an internal jira ticket for it. You can ignore them if you see them in output console, and I don't believe are relevant to the crash described here.

ASSERTION: There is no current snapshot
  Shared.dll!TgroupCmd::undoIt Line 1699 
  CommandEngine.dll!TcommandContainer::undoIt Line 115 
  CommandEngine.dll!TundoManager::undo Line 888 
  CommandEngine.dll!TundoAction::doCommand Line 103 
  CommandEngine.dll!Mel_Command_Dispatch Line 399 
  CommandEngine.dll!node_exec Line 517 
  CommandEngine.dll!sophia_call_executable Line 437 
  CommandEngine.dll!SophiaExecutable::evaluate Line 1024 
  CommandEngine.dll!TcommandEngine::executeCommand Line 596 
  ExtensionLayer.dll!TscriptActionMixin::execute Line 287 
ASSERTION: Model is NULL
  Shared.dll!TgroupCmd::undoIt Line 1699 
  CommandEngine.dll!TcommandContainer::undoIt Line 115 
  CommandEngine.dll!TundoManager::undo Line 888 
  CommandEngine.dll!TundoAction::doCommand Line 103 
  CommandEngine.dll!Mel_Command_Dispatch Line 399 
  CommandEngine.dll!node_exec Line 517 
  CommandEngine.dll!sophia_call_executable Line 437 
  CommandEngine.dll!SophiaExecutable::evaluate Line 1024 
  CommandEngine.dll!TcommandEngine::executeCommand Line 596 
  ExtensionLayer.dll!TscriptActionMixin::execute Line 287

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 14, 2021

How strange - I'm running straight from the maya-usd without any Pixar-specific code at all against USD 21.05 and still experience the crash with the repro steps provided above. I can try digging in further on our side, but let me know if I can provide any more information to help you guys. I don't know if it makes a difference, but we are still using Python2 in our environment.

Here is our repro (thanks to Grace!)

  1. open a new empty maya file
  2. Create -> Universal Scene Description (USD) -> Stage with new Layer
  3. Right click on the proxy shape -> Add New Prim -> Cone (or another prim or xform)
  4. Right click on the proxy shape -> Add New Prim -> Cone (or another prim or xform)
  5. Select the 2 new prims and create a group by pressing ctrl+g
  6. Click on one of the newly created prims
  7. Trigger the transform manip by pressing w or e or r
  8. Ctrl+Z to undo the selection
  9. Ctrl+Z to undo the group -> crash

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 14, 2021

I crash if I run the below from the script editor, FYI. I did notice that it did NOT crash if you used hierarchy.createGroupCmd and execute/undo that groupCmd object, only if you use cmds. Interactively I'm using the Ctrl-G hotkey to group and Ctrl-Z to undo.

import maya.cmds as cmds
cmds.loadPlugin('mayaUsdPlugin.so')

import mayaUsd_createStageWithNewLayer
stagePath = mayaUsd_createStageWithNewLayer.createStageWithNewLayer()

import ufe
parentSceneItem = ufe.Hierarchy.createItem(ufe.PathString.path(stagePath))

proxyShapeContextOps = ufe.ContextOps.contextOps(parentSceneItem)
proxyShapeContextOps.doOp(['Add New Prim', 'Capsule'])
proxyShapeContextOps.doOp(['Add New Prim', 'Sphere'])

import maya.mel as mel
cmds.setToolTo(mel.eval('$tempVar = $gRotate'))

sel = ufe.GlobalSelection.get()
sel.clear()

capsulePath = ufe.PathString.path('|stage1|stageShape1,/Capsule1')
capsuleItem = ufe.Hierarchy.createItem(capsulePath)
sel.append(capsuleItem)
spherePath = ufe.PathString.path('|stage1|stageShape1,/Sphere1')
sphereItem = ufe.Hierarchy.createItem(spherePath)
sel.append(sphereItem)

cmds.group('|stage1|stageShape1,/Capsule1', '|stage1|stageShape1,/Sphere1')
cmds.undo()

@HamedSabri-adsk
Copy link
Contributor

Hi @dj-mcg , I tried your script which uses cmds undo/redo and wasn't able to crash.

This looks like to be related to missing fixes in the Maya version that you have. I would suggest trying the same workflows with "Maya Preview Release 125" and see if you can reproduce the crash.

Hope this helps.

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 16, 2021

Aha, that explains it - thanks @HamedSabri-adsk! Does this imply that we would need to wait for Maya 2023 for production to get this fix, or will the fix be included in updates to 2022?

@kxl-adsk
Copy link

Just to make sure we conclude here - were you able to confirm that the issue is fixed in the preview release?

And yes, we consider all fixes for crashes for backporting to older versions.

@dj-mcg
Copy link
Collaborator Author

dj-mcg commented Jun 16, 2021

I need to jump through some hoops to get it installed at Pixar so there will be a delay on our side in confirming the fix. However, I think we can assume that this is the issue.

Great news about this landing in minor releases, thanks for clarifying.

@wtelford wtelford assigned santosd and unassigned santosg87 Aug 2, 2021
@santosd
Copy link
Collaborator

santosd commented Aug 9, 2021

Hello @dj-mcg, just wanted to check back on this and see if you were able to test the fix. If you are not able to test at this time, we can go ahead and close the issue out for the time being and reopen if needed once you have been able to take a look. Thank you.

@wtelford
Copy link
Contributor

Closing for now. Feel free to re-open if the problem still exists.

@neilh-adsk neilh-adsk moved this to Done in maya-usd Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

No branches or pull requests

6 participants