Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007739opensim[REGION] Scripting Enginepublic2015-11-14 12:152015-11-21 08:01
Reporterlillith xue 
Assigned To 
PriorityhighSeveritycrashReproducibilityrandom
StatusnewResolutionopen 
PlatformPC/LinuxOSlinuxOS VersionopenSuSE 12.3
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0007739: [XENGINE] Crash Leading to Continous Loop and stack overflow
DescriptionI noted a random Crash leading to some kind of Coninous-Loop and ends in a Stack Overflow Crash.

It seems to happen random, but i noticed it often happens after standing up from a Poseball.

The Logs show a more complicated Sit-Script, but it also happens on lighter ones.

This worked well in <= 0.8.1

OpenSim-Version is 0.8.2.0-rc1
OS is openSuSE 12.3 64Bit
Mono-version is 3.10.0
Steps To ReproduceNot sure, standing up seem to make it happen more often.
Additional InformationCrash log taken out of Console/OpenSim.log:

OpenSim.log:

2015-11-14 20:39:27,351 DEBUG (STP:XEngine:38) - OpenSim.Region.ScriptEngine.Shared.Instance.ScriptInstance [SCRIPT INSTANCE]: Runtime error in script LXMP - Main 1.1 (event changed), part pillow 7af801a3-f088-4de8-8af0-bf7bea2e231b at <257.6613, 251.7621, 22.81649> in Tenebris Mysterium
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Server stack trace:
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0
  at OpenSim.Region.ScriptEngine.Shared.ScriptBase.Executor.ExecuteEvent (System.String state, System.String FunctionName, System.Object[] args) [0x00000] in <filename unknown>:0

Exception rethrown at [0]:
 ---> System.StackOverflowException: The requested operation caused a stack overflow.

Server stack trace:
  at System.Guid.op_Equality (Guid a, Guid b) [0x00000] in <filename unknown>:0
  at OpenMetaverse.UUID.Equals (UUID uuid) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.GenericEqualityComparer`1[OpenMetaverse.UUID].Equals (UUID x, UUID y) [0x00000] in <filename unknown>:0
  at System.Collections.Generic.Dictionary`2[OpenMetaverse.UUID,OpenSim.Region.Framework.Scenes.ScenePresence].TryGetValue (UUID key, OpenSim.Region.Framework.Scenes.ScenePresence& value) [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneGraph.GetScenePresence (UUID agentID) [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.Scene.GetScenePresence (UUID agentID) [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectPart.get_GroupPosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.SceneObjectGroup.get_AbsolutePosition () [0x00000] in <filename unknown>:0
  at OpenSim.Region.Framework.Scenes.ScenePresence.get_AbsolutePosition () [0x00000] in <filename unknown>:0
[Repeating many times until...]

Console:

Region (Tenebris Mysterium) # Stack overflow in unmanaged: IP: 0x7f5e26092ed3, fault addr: 0x7f5dcd5f56e0
Stack overflow in unmanaged: IP: 0x7f5e2608d8f8, fault addr: 0x7f5dcd5f4fb8
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.

20:28:03 - [SCENEGRAPH]:
[screen is terminating]

The "changed event" of the script "LXMP - Main" causing the Problem:

   changed( integer change )
    {
        if( change & CHANGED_LINK )
        {
            kAvatar = llAvatarOnLinkSitTarget(LINK_THIS);
            
            GetSeatedAvatars();
            
            if( kAvatar != NULL_KEY && kMyAvatar == NULL_KEY )
            {
                kMyAvatar = kAvatar;
                llRequestPermissions( kAvatar, PERMISSION_TRIGGER_ANIMATION );
            }
            else if (kAvatar == NULL_KEY)
            {
                llMessageLinked(LINK_SET,-105,"",kMyAvatar);
                kMyAvatar = NULL_KEY;
                bAutoTrap = FALSE;
                llSetTimerEvent(30);
                kAvatar = NULL_KEY;
                if( nAnimating == TRUE )
                {
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot1 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot2 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot3 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot4 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot5 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot6 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot7 + " unlink");
                    llSay( -9119, "lockguard " + (string)kAvatarOld + " " + sLastLinkSpot8 + " unlink");
                    llMessageLinked(LINK_SET,303,llList2String(lRestrictions,llListFindList(lRestrictionNames,[sCurrentAnimation])),kAvatarOld);
                    llStopAnimation( szAnimation );
                    //llResetScript();
                    nAnimating = FALSE;
                }
                if( nAlwaysShow == TRUE || nAlwaysHide == FALSE )
                {
                    llSetAlpha( 1, ALL_SIDES );
                    llSetText( szTitle, vTitleColor, fTitleOpacity );
                }
                else if( nAlwaysHide == TRUE )
                {
                    llSetAlpha( 0, ALL_SIDES );
                    llSetText( "", <1,1,1>, 1 );
                }
                
            }
            else
            {
                llMessageLinked( LINK_SET, LinkedIdentMenuResponse, sCurrentAnimation, kAvatar );
            }
            
        }
        
    }

integer GetSeatedAvatars()
{
    lSeatedAvatarKeys = [];
    lSeatedAvatarNames= [];
    integer result = -1;
    integer i;
    for (i=0; i<=llGetNumberOfPrims(); i++)
    {
        if (llAvatarOnLinkSitTarget(i) != NULL_KEY)
        {
            lSeatedAvatarKeys = lSeatedAvatarKeys + [llAvatarOnLinkSitTarget(i)];
            lSeatedAvatarNames= lSeatedAvatarNames+ [ValidateHGNames(llKey2Name(llAvatarOnLinkSitTarget(i)))];
        }
    }
    return result;
}
TagsNo tags attached.
Git Revision or version number0.8.2.0-RC1
Run Mode Grid (1 Region per Sim)
Physics EngineODE
Script Engine
EnvironmentMono / Linux64
Mono VersionOther
ViewerFirestorm 4.7.3.47323
Attached Files

- Relationships

-  Notes
(0029565)
UbitUmarov (administrator)
2015-11-19 04:48

That looks like that object thinks it is attached to the avatar sitting on it causing that nice loop
(0029566)
Mata Hari (reporter)
2015-11-19 05:35
edited on: 2015-11-19 05:46

Several problems:

On the first iteration of the for loop in GetSeatedAvatars() the value of i is 0 which is invalid as an input for llAvatarOnLinkTarget(). Link numbers will always be >0 unless the object containing the script is a single prim with nobody seated on it (which you need to catch separately if the script is intended to be used that way).

That function uses llGetNumberOfPrims which returns a result that includes seated avatars. As a result, when someone is seated in it the loop will also attempt to test the seated avatar for someone seated on it...I haven't tried doing that before but I suspect it would throw an error (or ought to).

That same function will never return a result other than -1 because at no time does it alter the value of "result". You'll want to have any non-NULL_KEY result of the sitter test also change the value of result to 1.

http://wiki.secondlife.com/wiki/LlAvatarOnLinkSitTarget [^]


Something like this should work:

integer GetSeatedAvatars()
{
    lSeatedAvatarKeys = [];
    lSeatedAvatarNames= [];
    integer result = -1;
    integer i
    integer p=llGetNumberOfPrims();
    if (p==1) return result;
    for (i=1; i<=p; i++)
    {
        if (llGetAgentSize(llGetLinkKey(i)==ZERO_VECTOR)) // must test this separately because LSL attempts to run all checks that are ANDed
        {
            if (llAvatarOnLinkSitTarget(i) != NULL_KEY)
            {
                result=1;
                lSeatedAvatarKeys = lSeatedAvatarKeys + [llAvatarOnLinkSitTarget(i)];
                lSeatedAvatarNames= lSeatedAvatarNames+ [ValidateHGNames(llKey2Name(llAvatarOnLinkSitTarget(i)))];
            }
        }
        else i=p; // seated avi will always have a link number > than the last link of a prim so encountering an avatar as the link means you have tested all prims and no need to keep testing
    }
    return result;
}

(0029577)
UbitUmarov (administrator)
2015-11-19 17:31

wear the pillow, then drop it to ground, not passing by inventory..
still happens?
(0029596)
lillith xue (reporter)
2015-11-21 08:01

Since i deleted the Pillow, i rerezzed it, now i can't reproduce it. The problem is,that this didn't happen all the time, but quite randomly. I need some more testing.
Give me some Time to see if attaching and dropping fixes the Problem.

Mata Hari: Thank you for pointing this. It seems to be ignored if you check for Avatars sitting on Avatars :-) But you are right, thats not nice at all. I will change it. Badly this seem not to be the issue with that Crash, since i did see this happen with my other Poseball's too that do not have this function.
This is a Part of a Set of scripts, that are not intended to be used on single-prims.

- Issue History
Date Modified Username Field Change
2015-11-14 12:15 lillith xue New Issue
2015-11-19 04:48 UbitUmarov Note Added: 0029565
2015-11-19 05:35 Mata Hari Note Added: 0029566
2015-11-19 05:46 Mata Hari Note Edited: 0029566 View Revisions
2015-11-19 17:31 UbitUmarov Note Added: 0029577
2015-11-21 08:01 lillith xue Note Added: 0029596


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker