3DS MAX launching issues with different executable

I have some trouble to get 3ds Max 2016 to run with a “Launcher”. The “Launcher” is an executable (located on the server), which sets up the pipeline without using any local installed files. It also uses the same command line arguments like the original does. To get the pipeline running (for some process jobs) we needed to change the executable location in Deadline to launch Max via our “Launcher”.

After changing the executable location I was running into the following issues:

1. Deadline was using wrong paths, because it is setting up the Max directory locations with a relative path to the executable and not with the path from the system variable, so I had to change the 3ds Max plugin:

3dsmax.py:

[code]
[ 326] MaxLaunchExecutable = “”

[ …]

[ 587] # Seperate for override variable (because it’s used for many path constructions)
[ 587] self.MaxLaunchExecutable = self.MaxRenderExecutable

[ …]

[ 613] ### GET INSTALL LOCATION FROM ENVIRONMENT:
[ 614] for e in os.environ:
[ 615] max = re.search(r"3DSMAX\s*\S*(\d{4})", e, re.I) if not bool(re.search(r"VRAY", e)) else None
[ 616] if max:
[ 617] maxInstallDirectory = os.environ[e].strip(os.path.sep)
[ 618] self.MaxRenderExecutable = Path.Combine(maxInstallDirectory,“3dsmax.exe”)
[ 619] break

[ …]

[1024] self.LaunchMax( self.MaxLaunchExecutable, parameters, Path.GetDirectoryName( self.MaxRenderExecutable ) )

[/code]I just changed as little as possible to save time (line numbers could be different, because of some additional print statements).

2. Deadline is using it’s own startup script (dl.ini) and plugin, which is not a problem for the launcher, because it combines the plug-in ini-file and executes given scripts after the pipeline is loaded. This works fine with Shotgun and some other processes we have tested with the launcher, but it doesn’t work with Deadline.

The combined ini-file looks like this:

# Group Definitions:

[Directories]
blur=MAP_DRIVE:\\XXX\\startup\\2016\\plugins

[Include]
Deadline Lightning=C:\Users\loefflerm\AppData\Local\Temp\lightningplugin_638106471024.ini
Original=C:\3dsMax2016\3ds Max 2016\en-US\plugin.ini
UserProfile=C:\Users\loefflerm\AppData\Local\Autodesk\3dsMax\2016 - 64bit\ENU\Plugin.UserSettings.ini

Deadline uses the following arguments to launch max:

-p "C:\Users\LOEFFL~1\AppData\Local\Temp\dl.ini" -q -s "C:\Users\loefflerm\AppData\Local\Thinkbox\Deadline7\..\55a68ed9ccad8a0cfc452b8e\deadlineStartupMax2016.max"

The ini-file will be combined with our pipeline ini-file. All arguments and the scene file are passed to the Python Popen command, which the launcher uses to actually run the application.

Executing the command manually via the command prompt works fine:

"MAP_DRIVE:\XXX\YYY\launcher\bin\3ds Max 2016.exe"  -q -s -p "c:\users\loeffl~1\appdata\local\temp\tmpkmpiud.ini" -U MAXScript "MAP_DRIVE:\\XXX\\YYY\\launcher\\3dsMax\\startup.ms" "C:\\Users\\loefflerm\\AppData\\Local\\Thinkbox\\Deadline7\\slave\\ZZZ\\plugins\\55a682eaccad8a0cfc452b8b\\deadlineStartupMax2016.max"

But when Deadline starts the job, Max is closing before it could connect via the socket to Deadline.
Deadline Output:

=======================================================
Error
=======================================================
Error: 3dsmax startup: Error getting connection from 3dsmax: Monitored managed process "3dsmaxProcess" has exited or been terminated.


   at Deadline.Plugins.ScriptPlugin.StartJob(Job job, String& outMessage, AbortLevel& abortLevel)

=======================================================
Type
=======================================================
RenderPluginException

=======================================================
Stack Trace
=======================================================
   at Deadline.Plugins.Plugin.StartJob(Job job)
   at Deadline.Slaves.SlaveRenderThread.a(TaskLogWriter A_0)

=======================================================
Log
=======================================================
2015-07-15 17:48:38:  BEGIN - ZZZ\loefflerm
.
.
2015-07-15 17:48:38:  0: INFO: Rendering with executable: MAP_DRIVE:\XXX\YYY\launcher\bin\3ds Max 2016.exe
.
.
2015-07-15 17:48:38:  OriginalFilename: 3ds Max 2016.exe
2015-07-15 17:48:38:  FileVersion:      1.0.0
2015-07-15 17:48:38:  FileDescription:  
2015-07-15 17:48:38:  Product:          Launcher
2015-07-15 17:48:38:  ProductVersion:   1.0.0
2015-07-15 17:48:38:  Debug:            False
2015-07-15 17:48:38:  Patched:          False
2015-07-15 17:48:38:  PreRelease:       False
2015-07-15 17:48:38:  PrivateBuild:     False
2015-07-15 17:48:38:  SpecialBuild:     False
2015-07-15 17:48:38:  Language:         English (United States)
.
.
2015-07-15 17:48:39:  0: INFO: Plugin ini file: C:\3dsMax2016\3ds Max 2016\en-US\plugin.ini
.
.
2015-07-15 17:48:39:  0: INFO: Lightning connection plugin: C:\..\Thinkbox\Deadline7\...\lightning64Max2016.dlx
2015-07-15 17:48:39:  0: INFO: 3dsmax socket connection port: 63597
.
.
.
2015-07-15 17:48:39:  0: INFO:  -- Arguments:  -p "C:\...\Temp\dl.ini" -q -s "C:\...\Thinkbox\...\deadlineStartupMax2016.max"
.
.
2015-07-15 17:48:39:  0: INFO: Running as user: loefflerm
2015-07-15 17:48:39:  0: INFO: Executable: "MAP_DRIVE:\XXX\YYY\launcher\bin\3ds Max 2016.exe"
2015-07-15 17:48:39:  0: INFO: Argument:  -p "C:\Users\LOEFFL~1\AppData\Local\Temp\dl.ini" -q -s "C:\..\Thinkbox\..\deadlineStartupMax2016.max"
2015-07-15 17:48:39:  0: INFO: Startup Directory: "C:\3dsMax2016\3ds Max 2016"
2015-07-15 17:48:39:  0: INFO: Process Priority: BelowNormal
2015-07-15 17:48:39:  0: INFO: Process Affinity: default
2015-07-15 17:48:39:  0: INFO: Process is now running
2015-07-15 17:48:39:  0: INFO: Waiting for connection from 3dsmax
2015-07-15 17:48:40:  0: WARNING: Monitored managed process 3dsmaxProcess is no longer running

I am not sure what exactly goes wrong. Is the managed process working with Python Popen, or is it a different process execution?
It would helpful if I could recreate the issue with the manual execution vie the command prompt, but therefor I need more information how the job actually launches the application. In the task manager I could see Max starting, but closing after it was loading 340 MB into the RAM.
So the launcher is executing 3ds Max.

I was also tryed it with a higher timeout to connect Deadline with Max:

[ 1708]                self.MaxSocket.WaitForConnection( 5000, True )

Any ideas, which helping me to solve this problem are welcome!!!

Thanks,

Michael

I don’t fully understand what your trying to do here, but it may well be better to roll your own custom plugin which just drives “3dsmax.exe” with a a maxscript than trying to re-use our shipping “3dsmax” plugin (which is what I think your doing), as our startup.max file (with an embedded portion of code in it) is loading our Lightning.dlx plugin. Are you trying to execute “3dsmax.exe” from a network drive? If so, that won’t work, unless you ‘virtualise’ the application. However, I don’t believe this is officially supported by ADSK currently. So, it may well be easier to take a more simplistic plugin like the “3dsCmd” plugin and re-factor it to execute “3dsmax.exe” and feed it a maxscript for batch processing, if the existing “maxscript job” option in our “3dsmax” doesn’t give you enough control here, with regard boot-strapping from a custom ‘launcher’.

Hey Mike,

3ds Max is installed locally, only the location of the launcher is on a network drive.
We need everything going through the launcher, because it’s setting up the pipeline for 3ds Max. Without it, Max wouldn’t get the location of all plug-ins. Creating a new deadline plug-in would make sense if we would use Max with the launcher only for special operations and processes, but we also need it for the render process to get all plug-ins and settings integrated.

Right, I think the best way to get to the bottom of this, as we don’t have access to your custom launcher executable, is if you search your internal wiki docs for “debugging 3dsmax connection” or something similar to that wording. There will be a wiki page with a PDF attached to it, explaining how you can copy the “Lightning.dlx” c++ plugin to your local 3dsmax plugin directory / update your plugin.ini file to load it when 3dsMax loads. This will allow you to replicate your issue locally on your machine.

Note, the above process should only be done on a developer’s machine as a temporary debugging measure, as it will cause a duplicate plugin load if it tries to run a normal Deadline - 3dsmax job. Reverse the install process when your done.

You should then be able to attach VS to your Launcher app and view what is consequently happening to 3dsMax. I’ll make a note to possibly add these notes to our Deadline docs in a future release.

Hey Mike,

thanks for the hint.
I switched to another method to implement our new pipeline to a 3ds Max in Deadline.
It’s not using the Launcher any more, but it works.
I wrote a Deadline event which is simply just adding some system variables and switches a given script to the pipeline startup script.
The given script will be stored in a system variable and executed from the pipeline startup script (after the pipeline is initialized).

In the end the event is doing kind the same like the Launcher does (without the additional options and the launching itself).

I wish I would have more time to figure out why Deadline is not working when I changed the 3Ds Max executable path to the launcher exe path.
When I have some free time in between I will go back to this. I think it would help others, if you put the description about the lightning plugin and how it works into the Deadline docs.

Now a Max Job in Deadline is running with our network pipeline without having any scripts, ini files, or plugins installed on each machine locally.