Error in MapvoteLA13

Discussions about Coding and Scripting
Post Reply
User avatar
Barbie
Godlike
Posts: 1722
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Error in MapvoteLA13

Post by Barbie » Fri Jan 20, 2017 5:11 am

In the server logs I noticed the following:
servers log
Show
R@thske||er has voted for MH-Incursion+
ucc.init.log.3:MapVoteHistory1 MH-!!![DIE].MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:011F) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-!!![DIE].MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0139) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-!!![DIE].MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0153) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-!!![DIE].MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0193) Accessed array out of bounds (512/512)
[...voting was accepted, MH-Incursion+ loaded and just before first tick:]
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory0 (Function MapvoteLA13.MapVoteHistory_INI.FindIndex:005C) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory0 (Function MapvoteLA13.MapVoteHistory_INI.FindIndex:005C) Accessed array out of bounds (512/512)
[NSC-SYS] Nexgen Server Controller is active.
[... played the game ...]
2017-01-18 01:35:35 MH-Incursion+.MonsterHunt0.EndGame LOG_Debug: leaving sub routine, bGameEnded=True
[ EVENT ] The game has ended after 1352 sec.
Barbie has voted for MH-KrallFortress110
KillerGirl has voted for MH-KrallFortress110
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveOldestMap:002D) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:0034) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:004E) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:0068) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:007E) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:008C) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.RemoveMapByIndex:0099) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:011F) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0139) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0153) Accessed array out of bounds (512/512)
ucc.init.log.3:MapVoteHistory1 MH-Incursion+.MapVoteHistory1 (Function MapvoteLA13.MapVoteHistory_INI.AddMap:0193) Accessed array out of bounds (512/512)
ProcessServerTravel: MH-KrallFortress110.unr?game=BarbiesWorld.MonsterHunt
This pattern of error messages is repeated for several maps, but not for all; I guess it occurs only if a player votes for a map.

The corresponding file MapVoteHistory1.ini:
MapVoteHistory1.ini
Show
[MapVoteLA13.MapVoteHistory1]
M[0]=
M[1]=AS-AutoRIP
[...]
M[510]=MH-[TB]-UnrealWorld2010
M[511]=

P[0]=0
P[1]=1
[...]
P[510]=4
P[511]=0

S[0]=0
S[1]=2903
[...]
S[510]=362
S[511]=1
LastMapIndex=511
Noticeable is that LastMapIndex is 511, and all corresponding arrays in the source code have 512 elements - I looks like the typical off-by-one programming error. (I did not dig deep into the source.) For now I have reset LastMapIndex manually to 1. Maybe my sometimes hanging server has to do with this...

Any suggestions to solve this? Perhaps there is a better map vote mutator?
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 4141
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Error in MapvoteLA13

Post by sektor2111 » Fri Jan 20, 2017 7:14 am

You have to wrap letters again. There are loaded too many maps in a column. Some map titles having the same letter are just too many filling slots (around letter G ?). For sure some maps are being missing and nobody can vote them.

Aldebaran
Masterful
Posts: 672
Joined: Thu Jan 28, 2016 7:30 pm

Re: Error in MapvoteLA13

Post by Aldebaran » Fri Jan 20, 2017 2:14 pm

When your server is running under linux you can install a crontab script with commando "crontab -e".
In batch file you kill your ucc task and before restarting it, you automatically copy some mapvote template files with empty lists in it over the active ones.
So the server will restart with an empty mapvote history list every day.
The disadvantage of this is, one time a day the actual map will be interrupted, so I would do this at a time nobody should be on the server.

User avatar
sektor2111
Godlike
Posts: 4141
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Error in MapvoteLA13

Post by sektor2111 » Fri Jan 20, 2017 3:47 pm

Why to not simply redefine filters to not have 600 maps in a column and 200 in other ? - Actually, your measure I'm not sure if do helps because simply maps won't get loaded properly. Beside this, lists are loaded at each travel spamming console and not loading maps so player might see 645/789 maps loaded, the rest being invisible - I know what I'm saying because I fixed such a server which was not showing Godz Maps any more because they were not being listed, issue coming from filtering. I counted how many types MH-A* MH-B*.... existed and then sharing them properly through columns.

User avatar
Barbie
Godlike
Posts: 1722
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: Error in MapvoteLA13

Post by Barbie » Fri Jan 20, 2017 7:03 pm

sektor2111 wrote:You have to wrap letters again.
That's all nice and beauty but does not concern the problem. If you have a look for example at MapvoteLA13's code of MapVoteHistory_INI you'll notice

Code: Select all

var() config string M[512];
and later in function AddMap() such like

Code: Select all

Y=LastMapIndex;
if ( Y >= X )
{
	M[Y + 1]=M[Y];
If LastMapIndex is above ArrayCount(M)-2, the array is accessed beyond the upper boundary, and this is the case here.

BTW: I don't use file filters but I prepare the MapListTemp.ini manually. Current count:
Listindex 1: 121 maps ("small maps")
Listindex 2: 198 maps ("medium maps")
Listindex 3: 117 maps ("huge maps")
Listindex 4: 21 maps ("new maps")
total unique map count (without list index 4): 436
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett

User avatar
sektor2111
Godlike
Posts: 4141
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Error in MapvoteLA13

Post by sektor2111 » Fri Jan 20, 2017 8:38 pm

In snipet, is a "X" in condition which right now I won't look for it since I haven't history issues at this moment. I will do an INI check for figuring my load.

Wait a minute: If I'm looking well there, looks like is not possible to have more history maps than global number 436+ maps unless you didn't do a proper cleaning at updating maps and you count history for map which doesn't exist any more. Duh, if I'll see such issues, history class won't be configured in INI, or READ-ONLY file will save me from any future pain. Not a big deal.

Edit: By curiosity I was looking at whatever MapVoteLA14 type which I have:

Code: Select all

function AddMap (string MapName)
{
	local int X;
	local int Y;
	local bool bFound;

	if ( MapName == "" )
	{
		GoTo JL86;
	}
	if ( LastMapIndex >= 512 )
	{
		RemoveOldestMap();
	}
......
It's like it should not be more than 512 debated... I gotta admit I miss-understood the issue first time, was not about map lists was history problem.

Post Reply