• All submissions to this site are governed by Second Life Project Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.
Issue Details (XML | Word | Printable)

Key: SVC-2192
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Babbage Linden
Reporter: Cenji Neutra
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
2. Second Life Service - SVC

Mono LSL compiler generates invalid IL code

Created: 17/Apr/08 06:36 PM   Updated: 28/May/08 09:59 AM
Return to search
Component/s: Scripts
Affects Version/s: Mono Beta
Fix Version/s: None

Issue Links:
Relates
 

Linden Lab Issue ID: DEV-15296


 Description  « Hide
One of my scripts compiles but then causes internal run-time errors during execution whereby the Mono VM reports invalid IL codes.

I can't reproduce the script here as it contains sensitive information, but I will provide it to a Linden who asks and will also see if I can produce a cut-down test-case that still causes the problem(s).

Here is the chat output:
[script:.Em: Script run-time error
[script:.Em: System.InvalidProgramException: Invalid IL code in LSL_ce3c952e_af6e_b0b2_f527_9bd927e76013:gregister (): IL_02b4: ret

at LSL_ce3c952e_af6e_b0b2_f527_9bd927e76013.ghandleLinkMessage (Int32 num, System.String str, Key id) [0x00000]
at LSL_ce3c952e_af6e_b0b2_f527_9bd927e76013.edefaultlink_message (Int32 sender_num, Int32 num, System.String str, Key id) [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]
[script:.Us: Script run-time error
[script:.Us: System.InvalidProgramException: Invalid IL code in LSL_ec68ae2d_44fd_826b_1ab2_65caa305c1f6:gnotifyUserScripts (int,string): IL_04e4: call 0x0a00001d

at LSL_ec68ae2d_44fd_826b_1ab2_65caa305c1f6.ghandleLinkMessage (Int32 num, System.String str, Key id) [0x00000]
at LSL_ec68ae2d_44fd_826b_1ab2_65caa305c1f6ghandleLinkMessageFrame.ResumeVoid () [0x00000]
at LSL_ec68ae2d_44fd_826b_1ab2_65caa305c1f6.edefaultlink_message (Int32 sender_num, Int32 num, System.String str, Key id) [0x00000]
at LSL_ec68ae2d_44fd_826b_1ab2_65caa305c1f6edefaultlink_messageFrame.ResumeVoid () [0x00000]
at LindenLab.SecondLife.UThread.UThread.Run () [0x00000]
at LindenLab.SecondLife.Script.Run (ScriptEvent evt) [0x00000]



 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Cenji Neutra added a comment - 17/Apr/08 06:52 PM
The errors above come from two different scripts (in the same prim). They're too complex for me to successfully create a cut-down test case (it seems like slight changes and insertion of debug output changes the result).
Perhaps the best bet would be if a Linden can contact me during business hours and I'll drop into the beta grid and give you the object. The scripts alone won't execute the offending code - so even having the asset indicated by the LSL_<key> above won't help you on its own.

Strife Onizuka added a comment - 18/Apr/08 06:02 PM
Could you post the contents of your handleLinkMessage function?

Scouse Linden added a comment - 19/Apr/08 12:56 PM
At least one of the bugs here is a duplicate.

If there's no sensitive info in them, post register() and notifyUserScripts() here please.


Scouse Linden added a comment - 22/Apr/08 04:04 AM
After further investigation these exceptions are consistent with the bug in returning keys.

Closing this issue as its the one with the least information.


Cenji Neutra added a comment - 25/Apr/08 12:58 PM
Thanks. I have a watch on this issue, but I didn't receive any email when you guys commented - is JIRA 'watching' currently broken?
I may be able to post the contents of register() and notifyUserScripts() if necessary - perhaps with some omissions.
Note that neither of them return any value (no return type specified and either no return statement, or only return statements with no value specified.

Cenji Neutra added a comment - 25/Apr/08 04:51 PM
The code for register(), slightly modified:

register()
{
llOwnerSay("blah blah");
list regparams = [llGetKey(), llGetOwner(), llStringToBase64(llKey2Name(owner))];
callRemoteFuncX("012345678"+(string)scriptIndex, ["abcdefghijklmnopqrstuvwx",
llDumpList2String(regparams + [llGetListLength(vars)] + vars,"#+@$&")]);
scriptIndex++;
if (scriptIndex == NumCommsScripts)
scriptIndex = 0;
}

and for notifyUserScripts(): (also slightly modified):

notifyUserScripts(integer type, string arg)
{
integer now = llGetUnixTime();
string leasedBy;
string leasedKey;
integer leasedForDays = 0;
integer leasedForMins = 0;

integer sendNotify = TRUE;

list data = [llGetKey(),model,cookie];

if (type == AL_NotifyType_Init) {
}
else if ((type == AL_NotifyType_Update) || (type == AL_NotifyType_LeaseChange) || (type == AL_NotifyType_DaysChanged)) {

if (getBool(_gLeased)) { leasedBy= getStr(_gLeasedName); leasedKey= getKey(_gLeaseKey); leasedForMins = (getInt(_gLeaseExpiry) - now) / intervalSecs("i"); leasedForDays = llRound( (float)leasedForMins / 1440.0 ); } else { leasedBy = "VACANT"; leasedKey = NULL_KEY; leasedForMins = 0; leasedForDays = 0; }

sendNotify = FALSE;
if ( (type == AL_NotifyType_Update) || (prevLeased==-1) || (prevLeased != getBool(_gLeased))

( ((prevLeasedMins == -99999) (prevLeasedMins != leasedForMins)) && (type == AL_NotifyType_DaysChanged))
(prevLeasedBy != leasedBy)
(prevLocName != gLocationName) (prevInterval != getStr(_gInterval))
(prevOptions != getInt(_gOptions)) )
sendNotify = TRUE;

if (sendNotify) { if ((prevLeased != getBool(_gLeased)) || (prevLeasedBy != leasedBy)) type = AL_NotifyType_LeaseChange; data = data + [llGetObjectName(),gLocationName,leasedKey,leasedBy,leasedForDays, getInt(_gIntervalRate), getInt(_gPrimLimit),getInt(_gLeaseExpiry),getStr(_gInterval),getInt(_gOptions)]; prevLeased = getBool(_gLeased); prevLeasedBy = leasedBy; prevLeasedMins = leasedForMins; prevLocName = gLocationName; prevInterval = getStr(_gInterval); prevOptions = getInt(_gOptions); }
}
else if (type == AL_NotifyType_TouchHold) { key agent = (key)arg; data = data + [agent]; }
else if (type == AL_NotifyType_LinkChange) { data = data + [arg,llGetLinkNumber()]; }

if (sendNotify) { data = [type]+data; string message = llDumpList2String(data, "-=-"); data=[]; llMessageLinked(LINK_SET,AutoLeaseStateChangeNum,message,""); llShout(userChannel, message); }
}

I'll re-open this, not because I have any further insight, but just because the dup'd issue seems to be specifically about functions that return keys. Neither function returns a key and only the last one even calls a function that returns a key (named getKey).
If I get time I'll experiment some more.


Cenji Neutra added a comment - 25/Apr/08 06:15 PM
I have a nice repo for the 'register' case above. I'll attempt same for the other case, but if they're different, I'll probably open a separate issue and reference it.

This script will crash with an invalid IL on reset:

f1(list args)
{
}

f2()
{
f1(["", llDumpList2String([],"")]);
}

default
{
state_entry()

{ f2(); }

}

the error received is:

[script:.E: Script run-time error
[script:.E: System.InvalidProgramException: Invalid IL code in LSL_ea0a0b25_2279_b6d2_1ebb_2dc428c5056e:gf2 (): IL_00cd: ret

at LSL_ea0a0b25_2279_b6d2_1ebb_2dc428c5056e.edefaultstate_entry () [0x00000]
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[])
at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]

Hope that helps.


Strife Onizuka added a comment - 26/Apr/08 12:06 AM - edited
I'm thinking there may be somewhat relation to SVC-809 , it would be nice if both could be fixed.

Scouse Linden added a comment - 26/Apr/08 12:57 AM
They both can be fixed, if you spot any other LSL language bugs please let us know.

Scouse Linden added a comment - 29/Apr/08 03:52 AM - edited
Simpler repro of the first

integer f(list l)
{
return 0;
}

default
{
state_entry()

{ list l = [0, f([])]; }

}

Or possibly even simpler:

default
{
state_entry()

{ list l = ["", []]; }

}


Periapse Linden added a comment - 28/May/08 09:59 AM
passed QA