XRef problem

Hello
Occasionally i have this kind of problem when i am trying to send rendering scene containing XRefs - popups a window with submitter script and a window with “-- unknown system exception” , though the file is being sent to render.
I use Merge xrefs options in submitter , just to weaken the load on network and to make things faster without additional files, also i had some problems with spawners not picking up xref files - this option solves that issue. BUT suddenly i started to have this error on random scenes and looks like submitter is deleting the render camera because after error pop ups i cannot find it anymore.
Can you please explain me how merging xrefs works step by step so maybe one of the steps fails for this scene ? Because a lot of other scenes are fine.
Maybe it is worth to make a script which will merge all xrefs and make it as a pre-render script ?
Thanks

This is error log from MaxScript listener

-- Error occurred in RestoreMaxFileCopy(); filename: C:\Users\oleg\AppData\Local\Autodesk\3dsMax\2014 - 64bit\ENU\scripts\SubmitMaxToDeadline_Functions.ms; position: 132916; line: 2795
--  Frame:
--   holdTempFileName: "C:\Users\oleg\Documents\3dsMax\autoback/maxhold.tmp"
--   holdExists: true
--   sourceFileName: "C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\max_backup_file.mx"
--   holdMaxDir: "C:\Users\oleg\Documents\3dsMax\autoback/"
--   holdFileName: "C:\Users\oleg\Documents\3dsMax\autoback/maxhold.mx"
--   called in SubmitJobFromUI(); filename: C:\Users\oleg\AppData\Local\Autodesk\3dsMax\2014 - 64bit\ENU\scripts\SubmitMaxToDeadline_Functions.ms; position: 508933; line: 10699
--  Frame:
--   badRegions: 0
--   passDependencyList: undefined
--   oldAmarettoExportMode: undefined
--   oldSSDialogState: undefined
--   Amaretto: undefined
--   theXRefObjects: #(<MixinInterface:deleted interface>)
--   oldRenderDialogState: true
--   initialArgs: StringStream:"-outputfiles
C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\submitOutput.txt
C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\submitExitCode.txt
C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\max_submit_info.job
C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\max_job_info.job
C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\FK_CSC_ESTABLISHING_[CD01].max
\\piknas003\Resources\SCRIPTS\UNC_Converter.ms
"
--   theFn: undefined
--   renderMsg: "Deadline Command BG 7.1 [v7.1.0.35 R  (2a6ca6695)]

Submitting to Repository: \\piknas003\DeadlineRepository7

Submission Contains the Following Auxiliary Files:
1) C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\FK_CSC_ESTABLISHING_[CD01].max
2) \\piknas003\Resources\SCRIPTS\UNC_Converter.ms

Result=Success
JobID=55e81a547c0ec7b4c0fefa48

The job was submitted successfully.
"
--   theFilterTime: undefined
--   extension: undefined
--   initialArgsFile: <File:C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\initialArgsFile.txt>
--   theViewCamera: undefined
--   canSubmitQT: true
--   previouslysubmittedJobs: undefined
--   oldPriority: undefined
--   theSceneXRefsCount: 3
--   OutputFilenameByUserPattern: undefined
--   retCode: #success
--   batchName: ""
--   oldMaxScriptFile: ""
--   VRAY_lowThreadPriority: true
--   filename: undefined
--   tempMaxFile: "C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\FK_CSC_ESTABLISHING_[CD01].max"
--   initialArgsFileName: ""C:\Users\oleg\AppData\Local\Thinkbox\Deadline7\temp\03_09_2015_11_00_45\initialArgsFile.txt""
--   oldSubmitMaxScript: false
--   ssP: dotNetObject:Autodesk.Max.StateSets.Plugin
--   oldVRayVFBState: false
--   oldSceneExplorerStates: #(false)
--   oldMeditLockedState: true
--   copyresult: undefined
--   TilesRendering: false
--   activeRegions: 0
--   oldMatEditorOpenState: false
--   sizeInMB: undefined
--   ssPi: dotNetObject:Autodesk.Max.StateSets.Plugin
--   theTime: undefined
--   numViews: undefined
--   FF_AssetTracker_Functions: undefined
--   warnAboutMissingFiles: true
--   txt: "Files"
--   theNetworkPath: undefined
--   MultiRegionRendering: false
--   bitmapFilenames: undefined
--   imsqFilename: undefined
--   doPassDependency: undefined
--   BitmapsCopyData: undefined
--   oldrendOutputFilename: undefined
--   path: undefined
--   PFPPL_RenderPassFunctions: undefined
--   theMessage: "The Scene Contains 13 Missing External Files.

"
--   theBitmapsFileName: ""
--   BRAZIL_lowThreadPriority: undefined
--   frameList: undefined
--   theAnswer: undefined
--   queryExternalFiles: true
--   theMaxFileName: undefined
--   directory: undefined
--   called in btn_submit.pressed(); filename: C:\Users\oleg\AppData\Local\Autodesk\3dsMax\2014 - 64bit\ENU\scripts\SubmitMaxToDeadline.ms; position: 58515; line: 1431
--  Frame:
--   result: undefined
--   count: undefined
--   FFPPL_RenderPassVoodoo_Dialog: undefined
--   sanity: true
--   theMessage: undefined
>> MAXScript Rollout Handler Exception:
-- Unknown system exception <<

And this is the code of MaxScript dropbox.com/s/b2d7emmr0tyg8 … 0.png?dl=0 this error appears with line 2795 selected.

Also to explain my workflow - i have 1 deadline slave , 2 spawners and a repository, job is sent to slave where i have readonly file with VRay DR settings and spawners , job being sent in Force Workstation Mode , upon starting spawners are picking up and start rendering all together.

First the bad news - ‘unknown system exception’ means exactly that - for whatever reason, MAXScript (and/or 3ds Max) became unstable and failed without a known reason. Could be a problem in the awful XRef implementation, or anything really. So it is not directly a bug in the submitter script, but a side effect of some other 3ds Max scene corruption.

As a rule, SMTD attempts to NOT modify the scene content between the moment you press the SUBMIT button and the moment the submission succeeds (or fails). Most of the time temporary changes are made to the scene and are restored again at the end. However, merging XRefs is a HUGE change to the scene content required to produce the temporary MAX file sent with the job, and saving the scene after the submission would produce a completely different file than the original one. To avoid this, SMTD saves a temporary copy of the scene using the maxhold system (equivalent to Edit>Hold / Edit>Fetch). It holds the scene content before the merging is performed, and restores it via fetch after the submission. Hold/Fetch is an ancient relic from the days of 3D Studio DOS which had no Undo/Redo system, so you had to hold the scene before performing high-risk operations. It survived the transition to 3ds Max, and can be used as a brute force Undo buffer.

In your case, the Fetch operation performed via MAXScript causes the ‘unknown system exception’.

One thing you could try is disabling the call to the RestoreMaxFileCopy() function.

  1. Navigate to your Repository folder.
  2. Navigate the /Submission/3dsmax/Main/
  3. Open the file SubmitMaxToDeadline_Functions.ms in a text editor (or the MAXScript Editor). Do NOT use the file that pops up when the error occurs, that is the local copy of the script on your computer and will be overwritten next time you launch SMTD.
  4. Locate the following code block:

--If the merging of XRef objects was requested and there were any, restore the copy of the scene from the temp. file if (SMTDSettings.MergeXRefsOnSubmission and theXRefObjects.count > 0) or (SMTDSettings.MergeSceneXRefsOnSubmission and theSceneXRefsCount > 0) then ( try(SMTD_MainRollout.Ui_report ">Restoring Original Scene From Backup File..." )catch() SMTDFunctions.RestoreMaxFileCopy SMTDPaths.RestoreTempMaxFile ) else --we only need to restore the paths if the scene was not restored from a temp. file ( if SMTDSettings.SubmitExternalFilesMode > 1 and not (SMTDSettings.UseBatchRender AND SMTDSettings.BatchRenderMode == 1) do --and SMTDSettings.SubmitExternalFilesMode < 4 ( try(SMTD_MainRollout.Ui_report ">Restoring Original External File Paths..." )catch() SMTDFunctions.restoreExternalReferencePaths() ) )

  1. Remark the line by adding – in front of it:

--SMTDFunctions.RestoreMaxFileCopy SMTDPaths.RestoreTempMaxFile
6. Open SMTD and try to submit again.

As result, the scene will be modified during submission, but will not be restored after the submission finishes - you would have to reload from the original source file if you want your XRefs back.

See if this will avoid the error. It is not optimal in the long run, but is part of the debugging process.

Thanks for the explanation, Bobo , that clears some stuff.
Now on to the scene. It is quite big , in XRefs though there is only geometry (and materials obviously).
Thing you said

actually reminded me , that there was a really weird bug with 3dsmax and this scene yesterday when i was switching cameras - they were fading between switching.
It was literally a fade between views - new camera view was appearing on top of the old , until i refresh viewport by changing to another one , this is the first time i see such bug !
I think that this may be a scene corruption issue , as now i opened the same scene , tried to send it - and it went fine (yesterday it was constantly giving errors) , looks like machine reboot cleared some brains ?
But once i meet this thing again - i will try commenting that part of code and will report here.
Thanks a lot !