Game Development Community

T3D 1.1 Final - Deadlock & crash when using mounted objects - CONFIRMED (THREED-1981)

by Fyodor -bank- Osokin · in Torque 3D Professional · 06/08/2011 (8:46 am) · 7 replies

Build: T3D 1.1 Final (and any pre-final versions of T3D 1.1)

Platform: All/Any

Target: Engine (C++), Mounting objects

Issues:
1. If you have objects in scene mounted and "parent" fails to load, it will crash/deadlock when running outside of VS.
2. If you have prefab where objects mounted and "parent" fails to load, it will always crash.

Steps to Repeat:
//Place following code into .mis file.
      new PointLight() {
         radius = "5";
         isEnabled = "1";
         color = "1 1 1 1";
         brightness = "1";
         castShadows = "0";
         priority = "1";
         animate = "1";
         animationPeriod = "1";
         animationPhase = "1";
         flareScale = "1";
         attenuationRatio = "0 1 1";
         shadowType = "DualParaboloidSinglePass";
         texSize = "512";
         overDarkFactor = "2000 1000 500 100";
         shadowDistance = "400";
         shadowSoftness = "0.15";
         numSplits = "1";
         logWeight = "0.91";
         fadeStartDistance = "0";
         lastSplitTerrainOnly = "0";
         representedInLightmap = "0";
         shadowDarkenColor = "0 0 0 -1";
         includeLightmappedGeometryInShadow = "0";
         position = "0.224487 0.362549 5.43251";
         rotation = "0 0 -1 110.91";
         mountPID = "252d4f17-40bf-11e0-910e-dcc674078c71";
         mountNode = "1";
         mountPos = "0 0 0";
         mountRot = "1 0 0 0";
         canSave = "1";
         canSaveDynamicFields = "1";
         persistentId = "49a09ecd-3dd1-11e0-b058-f824fdb46369";
      };
      new StaticShape() {
         dataBlock = "BadDatablock";
         position = "-0.224487 -0.362427 3.43251";
         rotation = "0 0 -1 5.57327";
         scale = "1 1 1";
         canSave = "1";
         canSaveDynamicFields = "1";
         persistentId = "252d4f17-40bf-11e0-910e-dcc674078c71";
      };

Start debug version of engine and it will crash (deadlock).
If running from VS, it will load fine, except it will spam the console:
GameBase::setDatablockProperty - Could not find data block "BadDatablock"
ShapeBase::onAdd - no datablock on shape 4146:StaticShape ((null))
40: Register object failed for object (null) of class StaticShape.
which is okay (and correct way of handling this).

For the prefab issue, paste the code-part inside prefab and place it in the mission. It will always crash, even when running from debugger.

The prefab-crash happens in:
void SceneObject::resolveMountPID()
{
   if ( mMountPID && !mMount.object )
   {
      SceneObject *obj = dynamic_cast< SceneObject* >( mMountPID->getObject() );
      if ( obj )      
         obj->mountObject( this, mMount.node, mMount.xfm );      
   }
}
as the mMountPID is a valid, but getObject() returns garbage (0xfdfdfdfd) so the dynamic_cast crashes.

Suggested Fix:
None yet.

#1
06/08/2011 (9:32 am)
Logged as THREED-1981.
#2
06/08/2011 (9:34 am)
Have you gotten this with a prefab that didn't have dynamic lights as part of it? There's a known issue with prefabs that have dynamic lights that can result in a crash.
#3
06/08/2011 (9:48 am)
Hm.. it doesn't crash when I replace light with TSStatic.
And looks like it's something with dynamic lights itself (when mounted).
As when I don't use prefab and have TSStatic directly mounted to StaticShape (and StaticShape fails to load) it doesn't crash.
#4
06/08/2011 (1:00 pm)
There are some issues lately that got logged. How will those fixes be updated to the engine?
#5
06/08/2011 (1:10 pm)
@bank
Sounds like this is probably the root cause of the case that we discovered in testing then.

@Alexander
Same way as always, in the next update.
#6
06/15/2011 (3:06 pm)
Bug confirmed.
#7
06/16/2011 (5:08 pm)
I get a deadlock on loading a mission when I am missing a model used in a physicsshape datablock..I have crashed from this as well.

..I'm thinking they're of the same problem ?..hopefully anyhow.

//Edit: I have also had it not stall and just work. ..this is odd. Perhaps ignore this post until I can sort this though more use.