calling llGetNumberOfNotecardLines() then llGetNotecardLineSync() forever corrupts a region's notecard cache data
complete
Log In
This post was marked as
complete
Maestro Linden
tracked
Maestro Linden
Lucia Nightfire Okay, after modifying your original script a bit, I think I have a repro. I modified the script to iterate through all notecards of prim inventory, and print out line 0 using your original method of hammering
llGetNotecardLineSync
calls until it returns a not-NAK value. Once it gets a non-NAK value, the script prints out line 1 of the notecard using llGetNotecardLineSync() as well.Here's the repro script:
default
{
touch_end(integer i)
{
if (llDetectedKey(0) == llGetOwner())
{
if (!llGetInventoryNumber(INVENTORY_NOTECARD))
{
llOwnerSay("No notecards in inventory.");
return;
}
integer j;
for(j = 0; j < llGetInventoryNumber(INVENTORY_NOTECARD) ; j++)
{
string n = llGetInventoryName(INVENTORY_NOTECARD, j);
key k = llGetInventoryKey(n);
if (k)
{
integer line = (integer)llGetObjectDesc();
string s;
integer success = FALSE;
llGetNumberOfNotecardLines(n);
for (i = 1; i < 100001 && !success; i++)
{
if ((s = llGetNotecardLineSync(n,line)) != NAK)
{
llOwnerSay("Line of length " + (string)llStringLength(s) + ", prefixed by '" + llGetSubString(s, 0, 15)
+ "'... returned by llGetNotecardLineSync() when reading line " + (string)line + " of notecard '" + n + "' after "
+ (string)i + " attempt" + llList2String(["s",""],i == 1) + ".");
llOwnerSay("Line 1 value of notecard '" + n + "' is: '" + llGetNotecardLineSync(n, 1) + "'");
success = TRUE;
//return;
}
}
if(success == FALSE) llOwnerSay("line " + (string)line + " of notecard '" + n + "' failed to be read by llGetNotecardLineSync() after "
+ (string)i + " attempt" + llList2String(["s",""],i == 1) + ".");
}
else
{
llOwnerSay("Notecard '" + n + "' must be full-perms and not blank.");
}
}
}
}
}
Example notecard contents:
A line 0: news: On the other end of the spectrum... [more text - 1200ish bytes total]
A line 1
...
A line 9
A line 10
I then created 26 new notecard assets (each named after a letter of the alphabet), and set them up so that each contained text specific to the notecard name (e.g. "A") and line number. I made each line very long (a bit over 1200 bytes) and kept the rest of the lines short.
When the script reads the notecards, it starts off printing the correct data for each notecard, but eventually prints totally incorrect data.
Signal Linden
under review
Rider Linden
Please define "screwed up". What exactly are you seeing?
I'm not sure your script will actually work as you expect. It does look as though you are calling llGetNumberOfNotecardLines and then immediately calling llGetNotecardLineSync several thousand times until you get a non-NAK response. llGNONL will cause the simulator to queue that notecard to be cached. There is a great likelihood that it won't actually finish getting your notecard before your loop finishes. The only sure way of knowing that the notecard data is ready is to wait for the data_server event generated by llGetNumberOfNotecardLines.
Lucia Nightfire
Rider Linden: Right, that script is to blindly wait on caching w/o usage of request keys and a dataserver event. It is not to simulate a production script at all. I hope no one makes such a production setup either. It is strictly for testing if partially cached data would occur, but I hadn't evolved it into an elaborate setup yet. Seeing as cache was spitting out partial data and inserting newlines at the beginning of the partial data, it didn't matter at that point. A bug definitely occurred. I ran out of time and had to log as I have work in RL, heh. I'll try and make an elaborate setup soon, though.
Lucia Nightfire
The above script screwed up the notecard cache in Mauve on aditi, but I can't repro in Jigglypuff. I thought it might have had something to do with a notecard that had an empty string for line 0 data, but that didn't repro either.
Either way, once Mauve's notecard data became corrupt, all additional notecards read with a more traditional script, one that waits on a dataserver event, also return partial data for lines 0 to 2, often times adding a new line to the beginning of the data.
Maestro Linden
Lucia Nightfire: I can reproduce the funky notecard behavior in aditi/Mauve, which has not been restarted since you filed this bug.
I'm testing with a traditional 'Notecard Reader' script that uses llGetNoteCardLine() to read all lines of a notecard until it hits EOF. On other regions (including on the same host as Mauve), the script reads the 4 very-long lines of my notecard properly. On Mauve, the same scripted object reads the same notecard in 74 short lines. A separate script which calls llGetNumberOfNotecardLines() on the test notecard also returns 74.
I'm not sure what the repro is for this issue, yet. If I simply rez your script in a different region on this build and have it operate on either a cached or uncached notecard, other test scripts are able to read notecards properly.