Legacy MPxNode plug-ins defaulting to parallel evaluation: what are the actual limits and risks?
0 reputation · 19 Nov 2021, 15:10 UTC
0 reputation · 19 Nov 2021, 15:10 UTC
I'm auditing a set of older C++ plug-in nodes (compiled against pre-2016 Maya APIs) that are now loaded in a modern Maya version where the Evaluation Manager runs in parallel mode by default. These nodes predate MPxNode::evaluationMethod(), so they cannot declare kSerial or kDefer — as I understand it, they silently fall back to kParallel.
Some of these nodes access shared state inside compute(): static caches, non-reentrant third-party libraries, and in one case file I/O. The documented contract says compute methods "should be thread-safe," but there appears to be no load-time enforcement, no runtime sandbox, and no automatic serialization for nodes that violate it.
My uncertainty is about the practical boundary of what Maya guarantees here. The Evaluation Manager UI reports parallel vs. serial node counts, and the Evaluation Graph Profiler shows region boundaries, but neither seems able to identify which specific custom nodes are unsafe — only the global serial-mode workaround, which costs significant rig performance.
Specifically:
evaluationMethod() consistent across Maya 2019 through current releases, or did the conservative heuristics change the fallback?The default‑to‑parallel behavior for legacy MPxNode plug‑ins that do not implement MPxNode::evaluationMethod() is consistent across Maya 2019 through Maya 2026; there is no per‑node way to force serial evaluation without recompiling the node. To attribute a race condition to a specific node, enable Maya’s Thread Safety Checking (or Evaluation‑log) and inspect the warnings/logs for the offending node.
Maya’s Evaluation Manager treats any node that lacks an explicit evaluationMethod() declaration as fully parallel (kParallel). This fallback has not been altered by later conservative heuristics, so the behavior is uniform in the stated version range.
evaluationMethod() are scheduled as kParallel in Maya 2019‑2026 (research finding).Evaluation → Enable Thread Safety Checking.<nodeName> accessed non‑thread‑safe static data".MPxNode::evaluationMethod() returning kSerial or kDefer, or make the compute method thread‑safe (e.g., remove static caches, protect I/O with mutexes, or use thread‑local storage).Missing diagnostic detail that could change the recommendation: Are you using a Maya version that includes Thread Safety Checking (introduced in Maya 2020)? If not, the only viable approach is global serial evaluation until you can rebuild the nodes.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.