Some bugs at commit revision 318

Here you can post threads specific to the current release of the core (099)

Moderator: POL Developer

Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Some bugs at commit revision 318

Post by Terciob »

Hey There, i'm creating this thread here cuz report bug appears to be offline.

So, first most important, a old and weird crash was figured (topic: http://forums.polserver.com/viewtopic.php?f=11&t=2511).
Pol crash on next script and on a high PC line, this happens when a npc is killed on his own cast spell script.
So, if i insert "applyrawdamage (caster, 5000)" inside flame strike script and npc cast flame strike, pol gonna crash on next script after flame strike.
Please guys, test if this happens on your server too.

[Work] Speedhack Prevention is not working for us, at all. Never worked in early revisions too. Unfortunately =/
No packet hook on walk/run request, no syshook on walkpushtru and tested with Cheat Engine wich makes my client send 13 walk packets per second.
Line SpeedhackPrevention=1 added to ssopt.

[Fixed] SendQuestArrow appears to not working in 318, command returns 1 but no arrow on client.

We have a trouble wich i guess is a memory leak: in less than 24 hours after server goes online, it reaches 4gb ram :(
Ram counter is going up in 50kb per second with 150 players online, we are running few tests to fugure out this, my bet this is a npc insue.

Everything else seems to be okey, no crash in 1 week, only one assertion failure on "contents_.empty(), containr.cpp, line 67", and got pretty stable up to 180 players online and a /data/ over 500mb.
Last edited by Terciob on Wed May 04, 2011 12:46 pm, edited 1 time in total.
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Some bugs at commit revision 318

Post by RusseL »

Terciob wrote: So, if i insert "applyrawdamage (caster, 5000)" inside flame strike script and npc cast flame strike, pol gonna crash on next script after flame strike.
mb you should recompile all ?

Code: Select all

01-15-2010 Turley:
   Changed: vitals::ApplyDamage( mobile, damage, userepsys := DAMAGE_USE_REPSYS, send_damage := DAMAGE_USE_DEFAULT )
            vitals::ApplyRawDamage( character, hits, userepsys := DAMAGE_USE_REPSYS, send_damage := DAMAGE_USE_DEFAULT )
            const DAMAGE_NO_SHOW := 0;
            const DAMAGE_SHOW := 1;
            const DAMAGE_USE_DEFAULT := 2;
            DAMAGE_USE_DEFAULT uses the SendDamagePacket setting from combat.cfg (Tomi)
User avatar
AsYlum
Grandmaster Poster
Posts: 109
Joined: Sun Feb 05, 2006 5:24 am
Location: Poland

Re: Some bugs at commit revision 318

Post by AsYlum »

Yup questarrow is broken but speedhackprevention works.

Just try to send yourself speedboost packet and walk/run for a while when unmounted:

SendPacket(who, "BF0006002601"); // turns on boost

SendPacket(who, "BF0006002600"); // turns off boost

Killing NPC while it's casting spell looks fine for me. No crash so far.
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Some bugs at commit revision 318

Post by CWO »

polserver: turley * r320 /trunk/pol-core/ (doc/core-changes.txt pol/pktdef.h): fixed Questarrow packet

Turley literally beat me to it by like 3 minutes :-)

Just as I was about to announce the fix I saw he already fixed it lol
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Some bugs at commit revision 318

Post by RusseL »

can someone explain me what is questarrow, how and wherefore can i use it?
User avatar
CWO
POL Expert
Posts: 1158
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA

Re: Some bugs at commit revision 318

Post by CWO »

SendQuestArrow(who, x, y)

It makes an arrow appear on your client pointing you in a direction. Its usually used for quests or treasure chests.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Some bugs at commit revision 318

Post by Turley »

CWO wrote:polserver: turley * r320 /trunk/pol-core/ (doc/core-changes.txt pol/pktdef.h): fixed Questarrow packet

Turley literally beat me to it by like 3 minutes :-)

Just as I was about to announce the fix I saw he already fixed it lol
sorry :P
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Arrow fixed, Speedhack works (not very well with changespeed programs, but its ok).

Anyone got troubles killing a npc inside his own cast script?
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Turley, I found out the problem with memory leak. Is just Walk or Run, can be a npc or player, makes memory increase. Is Weird but i've tested a lot this and back to pol 2010-01-02 with same tests nothing happened.

In tests, i used this a small and simple npc AI:

Code: Select all

use uo;
use os;
use npc;

var opponent;
var master;
var me := self();

program npc_teste ()

	enableevents (0x8+0x2);
	enableevents (0x00000010, 16);
	var ev;	
	while (self())	
		ev := wait_for_event(5);	
		if (ev)	
			case (ev.type)		
				0x2:
				0x8:			
				0x00000010:
				if (!ev.source.npctemplate)
					fight(ev.source);
				endif
			endcase	
		endif	
	endwhile
endprogram 

function fight (opponent)
	setopponent (opponent);	
	while (opponent)
		runtoward (opponent);
	endwhile
endfunction 

Code: Select all

use uo; 
program textcmd_createnpc(who, template)
	for i := 1 to 100
		CreateNpcFromTemplate( template, who.x, who.y, who.z, 0, who.realm);
	endfor 
endprogram
So, create a npctemplate, use command ingame to create a lot of npcs, make sure you are invul, hide and unhide to npcs attack you and start running, see in Windows Task Manager Pol memory increases gradually.
Also happens with players, but it is faster to test with npcs.
User avatar
AsYlum
Grandmaster Poster
Posts: 109
Joined: Sun Feb 05, 2006 5:24 am
Location: Poland

Re: Some bugs at commit revision 318

Post by AsYlum »

I've done similar tests with scripts like that. It looks like leak only in the beginning. After few seconds memory level is stable. No matter how many more npc's i'm spawning and killing.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

AsYlum wrote:I've done similar tests with scripts like that. It looks like leak only in the beginning. After few seconds memory level is stable. No matter how many more npc's i'm spawning and killing.
Glad to read this, i've tested with a clean pol with no syshook, no packethook, no others hardcore configs and memory got pretty stable too.
Something in my server is making this leak happens, i gotta hunt and try figure out.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

AsYlum, plz make a small test with this and see if this time have any memory insues:
pol/config/repsys.cfg:

Code: Select all

NameColoring NameColoring
{
   Attackable      905
   AttackableHighLight   3

   Criminal      905
   CriminalHighLight   4

   Murderer      38
   MurdererHighLight   6

   Innocent      90
   InnocentHighLight   1

   GuildAlly      68
   GuildAllyHighLight   2

   GuildEnemy      44
   GuildEnemyHighLight   5

   Invulnerable      53
   InvulnerableHighLight   1
}

General
{
    CriminalFlagInterval 120
    AggressorFlagTimeout 120
}

HookList Mystic
{
    NameColor       :repsys:repsys:NameColor
    HighLightColor  :repsys:repsys:HighLightColor
    OnAttack        :repsys:repsys:OnAttack
    OnDamage	    :repsys:repsys:OnDamage
    OnHelp          :repsys:repsys:OnHelp
}
[/size]
Make a pkg called repsys and fill repsys.src with this:

Code: Select all

use uo;
use os;
use file;
use util;
use polsys;
 
Program RepSys ()
	return 1;
endprogram 

exported Function NameColor (mobile, who) 
	return 1;
endfunction

exported Function HighLightColor (mobile, who)
	return 1;
endfunction 

exported function OnAttack(attacker, defender)
        return 1;
endfunction

exported function OnDamage(attacker, defender)
    return 1;
endfunction

exported function OnHelp(mobile, helped)
	return 1;
endfunction
[/size]

Turn on pol and make same test with npcs. Hope you have problems too :)
User avatar
AsYlum
Grandmaster Poster
Posts: 109
Joined: Sun Feb 05, 2006 5:24 am
Location: Poland

Re: Some bugs at commit revision 318

Post by AsYlum »

Well with repsys hook or w/o memory consumption looks pretty similar. I don't have enough time to do stress testing but i'll try to run one on weekend.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Turley, here are a ready-to-use test server with minimum file requirements to startup.
Just download (1,50mb); copy 099 britannia uoconverted realm to pol/realm/ folder and run pol.exe; connect with account "admin" and password "a".
Select char "adminum"; a alot of npcs gonna attack you instantly and the pol memory usage will growing up.

http://www.4shared.com/file/_I1wV4nd/Pol099_beta.html
OWHorus
Grandmaster Poster
Posts: 105
Joined: Sat Feb 04, 2006 1:24 pm
Location: Vienna, Austria

Re: Some bugs at commit revision 318

Post by OWHorus »

Terciob wrote:Turley, here are a ready-to-use test server with minimum file requirements to startup.
Just download (1,50mb); copy 099 britannia uoconverted realm to pol/realm/ folder and run pol.exe; connect with account "admin" and password "a".
Select char "adminum"; a alot of npcs gonna attack you instantly and the pol memory usage will growing up.

http://www.4shared.com/file/_I1wV4nd/Pol099_beta.html
Hello Terciob,

I was curious and downloaded your small test....

Some comments - hopefully helpful:
I installed it, copied the realm folder from my POL 0.99 test folder, and started the server. Logged in and arrived at GA, was attacked by the NPCs. So I think it worked as you intended. (The only thing I changed were the ports - I used 5004 for the client and 5003 as debug port, i.e. I swapped these port numbers).

After login (I did not move the test character) NPCs started to 'attack'. But there were lots and lots of dead NPCs lying around - why? Memory started to increase in increments of 8-20 kBytes, slowly but steadily.

But - NPCs had a lot of event queue overflows, permanently, so the event queues could be one reason for the permanent memory allocation. Also NPCs could not decay, because there are scripts missing and the decay did not work:
"Unable to read script 'scripts/control/OnDestroyCorpse.ecl'"

When I log off, the memory growing stops immediately. I could not really see it - what causes the NPCs to die?

So memory grows only, when I am attacked, but all they do is running around and having lots of event queue overflows.

I also used my own core (Rev 320, but complied with NET 2008 Express), the behavior was the same.

The memory growing seems to be connected to the event queue overflows. When I move the character to the other end of GA, very far away from the NPCs, event queue overflow has a much lower rate, but they still happen. Accordingly memory goes up, but much slower. When I log off, the NPCs seem to stop - no event queue overflows, no memory growing.

So maybe the event queue overflows are responsible for the slow memory growing? You could try (within this test scenario) to increase the event queue size and check if memory still grows. Also - what are these NPCs doing when the character they attack is very far away, more than 40 tiles? Are they still running around and trying to attack? Event queue overflows are slower (and so is memory grow), but still happen, if the character is on the far side of GA. Overflows only stop when I log off. Then memory stops to grow too - completely.

I also tried to activate the Windows Low Fragmentation Heap - makes no difference in behavior. So I would try to look into the event queue overflows. I do not know the AI scripts (we do not use the distro), but it is clearly connected to the AI script activities. Interesting that all stops, when I log off, but not when I am far away.

This are my ideas - I hope they are useful...

OWHorus
RusseL
Forum Regular
Posts: 375
Joined: Fri Feb 20, 2009 8:30 pm

Re: Some bugs at commit revision 318

Post by RusseL »

I think i have the same problem....


http://forums.polserver.com/viewtopic.php?f=20&t=3372
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Hi OWHorus, first of all, thanks for testing.

The corpses, scripts missing, event queue, i leave this because do not matters.
You can kill all this npcs and login with 3 chars (accounts admin2, admin3, password "a") and just run with then, memory will grow, slowly, but will.

This is update for ai stops event over flow and a command for freeze npcs: http://www.4shared.com/file/4V0vWVCZ/Pol099_update.html

So, use the command ".f" all npcs go freeze and stop move, memory instantly stops too. Use ".f 1" to release npcs from freeze, memory will back to growing up.

Inside pol/config/ have two repsys cfgs, rename repsys.cfg to repsys_enable.cfg and repsys_.cfg to repsys.cfg, run pol, logon, npcs will attack you and memory insue do not happens with repsys disabled.
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Some bugs at commit revision 318

Post by Turley »

First of all thx for the input. I tried it and had also the increasing memory, but sadly currently no idea what causes it.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

No problem, i gonna test commits to try discovery when this started to happens. Also i gonna try figure out why that weird crash on spell cast happens only in my server.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

After a few revisions compiled, i got it, this insue begun at commit 262:
"pktwriter test functions #define
Fixed: exported function calls a different exported function stops execution (eg repsys functions in same script)"

In 261 had no memory problem, on 262 memory growing up.

Bellow, the test server with both cores:
http://www.4shared.com/file/nWJg8Lww/Po ... 1_262.html
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Some bugs at commit revision 318

Post by Turley »

does rev 321 help?
OWHorus
Grandmaster Poster
Posts: 105
Joined: Sat Feb 04, 2006 1:24 pm
Location: Vienna, Austria

Re: Rev 321 looks good...

Post by OWHorus »

Hello,

I too saw problems: Running 320, compiled with 2008 Express, full world file, around 11.000 NPCs, full world with weather and so on, but no players online (at home), only me at times. In 8 hours the memory footprint grew from around 930 M to around 1030 M, i.e. ~100MB. Even completely idle and without player the core allocated blocks of around 4-20k (task manager) every few seconds

That would have meant around 300 MB a day, or 1 GB in 3 days. Manageable, but annoying.

Now with rev 321 its much better: In 1.5 hours (world file like before) the memory grew only around 10-20M, some of it owned to me testing NPCs and fighting, and the AI in general. Running idle the core has only few allocations (visible in the task manager at least), and sometimes memory goes down a bit. At the moment the core does not change memory in task manager, just running. This is a visible difference...

Looks very good!

Thank you
OWHorus
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Solved on test servers. But, unfortunately on my live shard the problem is still going on with 321 and i have no ideia what can be this time and where can i begin to looking for.

Edit: Memory grow seems more slow, after 20hrs online pol reachs 2,70gb memory usage, normally at this point was capped at 4gb. Some times memory goes down a bit and back to grow up.
Terciob
Master Poster
Posts: 90
Joined: Fri Nov 07, 2008 3:47 am

Re: Some bugs at commit revision 318

Post by Terciob »

Seems 324 definitely solved the problem:

Time | Memo
17:30: 1.873.708k
18:30: 1.902.600k
19:30: 1.926.272k
21:30: 1.987.484k
23:00: 2.010.704k
00:00: 2.047.492k
01:00: 2.065.688k
02:00: 2.066.068k

Server beat 178 players online between 21 and 23hr and looks pretty pretty stable.

Note: Multis working fine after a multi.SetCustom(1), SendHousingTool() seems work too. So, custom house close to hit the scene?
User avatar
AsYlum
Grandmaster Poster
Posts: 109
Joined: Sun Feb 05, 2006 5:24 am
Location: Poland

Re: Some bugs at commit revision 318

Post by AsYlum »

Great news! Ok so it's time to check new rev. Thanks Turley! ;)
Post Reply