Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Deferred commands stop being executed

Deferred commands stop being executed

contact
Contributor Contributor
1,009 Views
3 Replies
Message 1 of 4

Deferred commands stop being executed

contact
Contributor
Contributor

Hello!

 

I am using a script to set up the Maya workspace in a certain way.

Sometimes (~20% of the time), this leads to a situation where commands in the evalDeferred command queue stop getting executed, which freezes up the end of my script as well as making some parts of the Maya UI unresponsive (for example: I can no longer execute commands in the ScriptEditor, but can still execute commands in the command bar at the bottom of the Maya window.

 

The issue arises when operating with the TimeSlider and RangeSlider with commands like:

workspaceControl -e -visible 1 -floating true -raise TimeSlider; 
workspaceControl -e -visible 1 -floating true -raise RangeSlider;

but it's hard to tell when exactly the issue begins.

 

Anyway, when I check the command queue with evalDeferred -list, I see that the first command in the queue is:

timeField -edit -value `currentTime -query` TimeSlider|MainTimeSliderLayout|formLayout8|timeField1

But this command never gets evaluated and later commands just pile up behind it.

The command is in the "-lowPriority" category.

 

I can execute this command normally from the Maya command line, so there is no problem with the command itself.

Maybe the command execution is actually stuck on whatever command came before this command.

 

I have tried using maya.utils.processIdleEvents() to force Maya to execute the deferred commands, but it only returns "False" and nothing changes.

 

Maya does not seem to use much processor time (according to Windows Task manager), so I don't think there is any background computation waiting to be finished.

The situation also does not end by itself ever after waiting for hours.

Closing the floating TimeSlider/RangeSlider windows and opening them again often gets Maya "un-stuck", and execution of deferred commands continue.

 

What could be possible reasons for this happening and what could be possible solutions when such a thing happens?

 

Thank you!

Max

0 Likes
1,010 Views
3 Replies
Replies (3)
Message 2 of 4

tony.su
Autodesk Support
Autodesk Support

I couldn't reproduce your issue. Is there any way 100% reproduce your issue?  I couldn't find anything on it.



Tony Su
Product Support
0 Likes
Message 3 of 4

contact
Contributor
Contributor

Thank you for the message and sorry for the late reply.

 

Sadly, I can't offer a way to reproduce it in Maya alone 100% of the time, since it only happens in the context of a plug-in / scripts and even then let than 5% of the time.

 

After more investigation, it seems like it's caused by a race condition between the main thread executing the MEL command via MGlobal::executeCommandOnIdle() and a second thread (spawned in a plug-in) also executing a command via MGlobal::executeCommandOnIdle().

 

According to the documentation, executeCommandOnIdle() should be thread-safe, but is there a possibility it can lead to such an issue where deferred commands stop being processed?

0 Likes
Message 4 of 4

cheng_xi_li
Autodesk Support
Autodesk Support

Hi contact,

 

Could you send us a sample code for us to research? I didn't find any known reports about this issue in our system.

 

Yours,

Li

0 Likes