[Bug] 3dsmax job initial selection causes crash

We had a 3dsmax job failing miserably on the farm, and it turned out to be related to the SceneSelection job property. It listed 12753 nodes to be selected (i know…)

The crash happens after this line in the logs:

Note, i’ve added “2018-06-29 01:57:10: 0: INFO: >setRenderSetting: RenderWidth” in the log to figure out where exactly its hanging, and it happens right on this line in customize.ms:

local theVal = DeadlineUtil.GetJobInfoEntry param

And then max just poof, disappears. Maybe the excessively long job option is not being parsed correctly and the mongo document is malformed? Or just the DeadlineUtil cant handle the long parameter value?

The actual line from the info file is attached.

Logged it. I’ll bump the guys on this one.

Are you going to be seeing more of this issue for the project you’re on? Just trying to gauge importance here.

I saw a bug recently in 3dsmax, where instantiating an array has a limit. I think it’s a character length limit of a line you can execute in maxscript? You’ve got 102041 characters, which is quite a lot for one line :wink:

Cant really tell, we regularly have scenes with 10s of thousands of objects, so its a matter of “lucking out” that this wasn’t noticed before…

Well, this may take some doing if we need to re-implement parsing or something particularly tricky. If it starts becoming a nuisance, let me know.

I wonder about Dave’s comment… It’s a tough thing to Google for.

My suggestion would be to try switching the SMTDFunctions.CreateJobInfoFile() function’s code from

--Store Current Scene Selection local theSelectionArray = for o in selection collect o.inode.handle with PrintAllElements on format "SceneSelection=%\n" theSelectionArray to:JobInfoFile
to

--Store Current Scene Selection local theSelectionArray = for o in selection collect o.inode.handle with PrintAllElements on format "SceneSelection=%\n" (theSelectionArray as bitarray) to:JobInfoFile

In cases of lots of consecutive indices, the bitArray signature will express the ranges as M…N instead of listing all coma-separated indices, thus making the string A LOT shorter. Instead of containing 12753 integers, it would look like

#{275228..277926, 277928..278928, 278931..280933, 280935..282936, 282938..285238, 285240..287986}

Then the customize.ms code would loop over the bitarray (I don’t think we even have to convert to an array in memory), so it will use significantly less memory (one bit per object, instead of 4 bytes).

I have not tested this yet, but I am pretty sure you (Laszlo) could add the “as bitarray” to the existing code and see if it helps with newly submitted jobs… If it does, we can make the change on our side, too.

I don’t think we can do anything on the reading side for already submitted jobs, assuming the issue is in the MAXScript parser.

That being said, reading that file into MAXScript does not seem to cause any problems on my 10+ years old workstation. However, loading the text you sent in the MAXScript Editor surely messes it up (it hangs a lot). Opening in a stand-alone SciTE does not cause any problems.