#Python.NET in PreLoad.py failing.

Hi there,

I’m running Deadline 5.1 on Windows 7 and Win XP and whenever I place the #Python.NET tag in any PreLoad.py file in the houdini module (ahead of generating IFDS) I’m getting the below. Now I had a look for info on this and I understand that .net 2.0 SP2 framework is a minimum requirement but is there anything else I can do to prevent this from happening? I’ve got win7 here and an XP machine with .net 2.0 sp2 x64 on it but it’s still throwing up this MSCORELIB error on that XP box and simply returning the below on Win7x (all x64).

The repo and the client are both clean installs from scratch, indeed, I’ve flattened the repo entirely and tried again this morning along with un-installing the client and re-installing it.

I’m leaning to having to migrate some of the core functionality from our standard Python environment into IronPython, namely any pymysql, into flat auto-maintaining flat xml or files for setting our env vars ahead of launch. We need to do this since we’re a multi-version/build multi project studio etc.

*Now the weird thing is I first attempted the #Python.NET command it worked and I did drop in an imported path of PyMYSQL ok but when it started throwing errors up as I added more and more axis particular site-packages (in particular WMI api & Win32 tools) it ‘started’ throwing these errors. Not even flattening the repo or clients seems to be ‘reverting’ that initial success either. Is there any DLLs that can conflict. I can run a Procmon trace if it’d help.

Any advice?


0: INFO: About: Houdini Plugin for Deadline
0: INFO: PreLoadJob: Executing pre-load script
0: An exception occurred: An error occured in PreLoadJob(): Python Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. (System.AccessViolationException)
Stack Trace: 
   at Python.Runtime.Runtime.PyType_Ready(IntPtr type)
   at Python.Runtime.TypeManager.CreateType(ManagedType impl, Type clrType)
   at Python.Runtime.TypeManager.GetTypeHandle(ManagedType obj, Type type)
   at Python.Runtime.ClassManager.CreateClass(Type type)
   at Python.Runtime.ClassManager.GetClass(Type type)
   at Python.Runtime.ClassManager.GetClassInfo(Type type)
   at Python.Runtime.ClassManager.CreateClass(Type type)
   at Python.Runtime.ClassManager.GetClass(Type type)
   at Python.Runtime.TypeManager.CreateType(ManagedType impl, Type clrType)
   at Python.Runtime.TypeManager.GetTypeHandle(ManagedType obj, Type type)
   at Python.Runtime.ClassManager.CreateClass(Type type)
   at Python.Runtime.ClassManager.GetClass(Type type)
   at Python.Runtime.TypeManager.CreateType(ManagedType impl, Type clrType)
   at Python.Runtime.TypeManager.GetTypeHandle(ManagedType obj, Type type)
   at Python.Runtime.ClassManager.CreateClass(Type type)
   at Python.Runtime.ClassManager.GetClass(Type type)
   at Python.Runtime.TypeManager.CreateType(ManagedType impl, Type clrType)
   at Python.Runtime.TypeManager.GetTypeHandle(ManagedType obj, Type type)
   at Python.Runtime.ClassManager.CreateClass(Type type)
   at Python.Runtime.ClassManager.GetClass(Type type)
   at Python.Runtime.PyObject.FromManagedObject(Object ob)
   at FranticX.Scripting.PythonNetScriptEngine.CallFunction(Boolean interactive, String functionName, Object[] args)
 (Deadline.Plugins.RenderPluginException)

Cheers!

J.Murray
edit: *More info on failure circumstances.

Have you tried restarting the slave(s) after this error started appearing? I wonder if the slave’s memory is corrupt, and that’s why you get this error no matter what you do.

If that doesn’t help, could you post your PreLoad.py script in the simplest form that causes the crash? We can try it here to see if we can reproduce.

Cheers,

  • Ryan

Hi Ryan,

Ok, I’ve just thrown a default install of the repo and the client onto my own Win7 x64 laptop on my desk next to my workstation. Used a simple blender scene to get out a quick test render, just to eliminate the houdini aspect, on deadline and it behaves as you’d expect.

I introduce the Preload.py file into the plugin folder for blender without the

#Python.NET

tag and it works fine. As soon as I add in #Python.NET I get the corrupted memory error when I resubmit a fresh job (which takes along the updated Preload.py file).

Now only thing in common I can find here is the win x64 factor. The minimum spec of .NET 2.0 SP2 for Win7 x64 machines is hard to confirm as being met but when ever I tried to deploy .net 2.0 SP2 I get warnings and no-joy. From what I see about this online re:Win7x64 the default install of .NET 3.5 is the minimum spec and comes pre-installed for these win7 boxes. Automatic updates is most likely on for the win7 machines, but not the XP off the internet render node btw.

This is progress since it’s eliminated one factor of my situation here as reliably failing and I can re-focus on porting/testing with IronPython instead.

[code]
from System import *
from Deadline.Scripting import *

########################################################################

Main Function Called By Deadline

########################################################################
def main( *args ):
LogInfo( “Setting EnvVar1 to True” )
Environment.SetEnvironmentVariable( “EnvVar1”, “True” )[/code]

Cheers

J.Murray

Weird. We tested it out here on Win7 x64 SP1 and we couldn’t reproduce this problem. Having .NET 3.5, with all applicable Windows updates, should ensure you have the proper setup, and I don’t think your install of .NET is the problem here. If you were missing the SP2 part of the .NET 2.0 profile, then IronPython would complain about a missing method exception.

Hi Ryan,

Let me un-install any possible pre-existing competing Python environment elements, such as Python 3.2 and 2.64 x64 builds, from my laptop, I’ve also got a fresh box in the wings which I can test with tomorrow if needed.

If there’s anything I can debug and collate for you to show what’s going on please don’t hesitate to let me know. I can email you Logs and such no problems. I can also run Syternal’s Process Monitor tools and give you a log from that as well if it’d help.

Cheers

J.Murray

Update: Stripping out those Python installs did nothing post reboot and such. Looking more and more like a potential Microsoft Re-distributable clash to me.

Perhaps you could try upgrading to the Deadline 5.2 beta:
viewtopic.php?f=10&t=7543

It’s production-ready at this point. It ships with an updated Python.NET build, so maybe it’s possible the issue is addressed. I’m really not sure how to start debugging this issue. The logs don’t provide anything helpful, and it’s unfortunate that we can’t reproduce it here. So I guess a good start would be to see if it still occurs in 5.2, and then go from there…

Cheers,

  • Ryan

Thanks Ryan. Will keep you posted how it works out.

Cheers

Jamie

Hi there,

Initial testing seems to show this as being resolved in 5.2 so I’ll get this onto test server and see how it fares there. I’ll be sure to post any further questions about 5.2 on the beta pages. Many thanks for the speedy responses and help!

cheers
Jamie