MaterialX icon indicating copy to clipboard operation
MaterialX copied to clipboard

Calling GlslProgram.getUniformsList() / getAttributesList() from Python triggers STATUS_HEAP_CORRUPTION on Windows

Open ibvfteh opened this issue 4 months ago • 1 comments

TL;DR: Calling the GLSL program introspection helpers from Python getUniformsList or getAttributesList makes the process exit with STATUS_HEAP_CORRUPTION (0xC0000374). Skipping those calls avoids the crash.

I found that simply enumerating program uniforms or attributes is enough to poison the renderer lifetime. The script doesn't render or bind geometry, but the addition of that doesn't influence the error. It just compiles a shader, calls the introspection APIs, prints the keys, and then dies with Windows heap corruption as the interpreter shuts down. Any call after the getUniformsList or getAttributesList will crash the script (like rendering)

OS: Windows 10 (PowerShell)

Reproduction:

  • From the repo root, run python minimal.py. The helper loads standard_surface_brass_tiled.mtlx, builds GLSL, and immediately calls both introspection methods.

  • Observe the uniform/attribute lists print successfully.

  • The interpreter terminates with exit code -1073740940 (STATUS_HEAP_CORRUPTION).

  • Run python minimal.py--skip-uniforms with the introspection skipped, the process exits cleanly (code 0).

ibvfteh avatar Oct 21 '25 12:10 ibvfteh

I tried creating a virtual environment and installed only MaterialX 1.39.4 using pip and ran this script with Python 3.11.0. Other than taking a while to run I didn't get any crash. I also ran head of the repo (1.39.5) outside a virtual environment without any issues.

I've been rendering in Python for a number of years using this code.

I don't see anything obvious and as you mentioned Windows, have you tried on other platforms.

kwokcb avatar Oct 21 '25 15:10 kwokcb