Originally posted by [b]Gepard[/b]
Another bug about the same issue, with some info that could be helpful: [bug=1279] (http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=1279)
[b] [size=3]eAthena Support Board -> Bug Tracker -> eAthena -> Unit_remove_map Debug[/size][/b]
[font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on Mar 26 2008, 08:47 PM[/b]
[color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002585/163279 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=2). Please report this!!![/font][/color]
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on Mar 30 2008, 11:41 AM[/b]
[color=#003366][size=2]
Another one occured.
[/size][/color][color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002573/163399 (active=1 connect_new=0 rewarp=0 changemap=1 debug_remove_map=1) from map=anthell01 (users=0). Please report this!!![/font][/color]
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Slennox on Mar 30 2008, 04:33 PM[/b]
[color=#003366][size=2]
Testing revision 12430 with FlavioJS' debug code:
[/size][/color][color=#000000][size=2][b]
QUOTE[/b][/size][/color][color=#465584]
<%CIA-1> eAthena: 03FlavioJS * r12430 10/trunk/src/map/ (clif.c pc.h unit.c): * Added temporary code to track and prevent the multiple remove_map's that appear to be happening.
<[Blue]> hmmm
<DaIRC36694> Slennox, update and try this version
<DaIRC36694> make sure you log the console
<DaIRC36694> (debug info)
<DaIRC36694> night all
<DaIRC36694> oh ups
03* DaIRC36694 is now known as flaviojs
12* Akira sets mode: +o flaviojs
01<Slennox> thank you flaviojs, we'll try them tomorrow and report back during the week[/color]
After one week and a WoE disputed (400 ppl server):
[color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2001708/451 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=73). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002032/304 (active=1 connect_new=0 rewarp=0 changemap=1 debug_remove_map=1) from map=pay_gld (users=22). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002316/495 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=113). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2000092/1156 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=76). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2003577/3753 (active=1 connect_new=0 rewarp=0 changemap=1 debug_remove_map=1) from map=c_tower2 (users=0). Please report this!!![/font][/color]
This is very bad, it's happening in WoE maps

The WoE script seemed broken by the way, it didn't always respawn people out of the castle... but we don't know if it's related to that problem.
I have the full console server log in a file. If you need to search for other Debug messages I'll grep'em for you [img]http://www.eathena.ws/board/style_emoticons/default/smile.gif[/img]
Sle
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: flaviojs on Apr 7 2008, 01:58 PM[/b]
[color=#003366][size=2]
Forgot to mention here, more debug information was added in [url="http://svn.eathena.ws/bugs/changeset/12457"]r12457[/url]/[url="http://svn.eathena.ws/bugs/changeset/12458"]r12458[/url].
Please update to r12458+ and report the extended message, thank you.[/size][/color][/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on Apr 16 2008, 07:55 PM[/b]
[color=#003366][size=2]
Occured during WoE:
[/size][/color][color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002573/163427 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=5). Previous call from ..\src\map\unit.c:1821(unit_remove_map_pc), current call from ..\src\map\unit.c:1821(unit_remove_map_pc). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002533/162788 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=payg_cas03 (users=6). Previous call from ..\src\map\unit.c:1821(unit_remove_map_pc), current call from ..\src\map\unit.c:1821(unit_remove_map_pc). Please report this!!![/font][/color]
map/unit.c:1821:
[color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
void unit_remove_map_pc(struct map_session_data *sd, int clrtype)
{
unit_remove_map(&sd->bl,clrtype); // <-- line 1821
if (clrtype == 3) clrtype = 0; //3 is the warp from logging out, but pets/homunc need to just 'vanish' instead of showing the warping out animation.
if(sd->pd)
unit_remove_map(&sd->pd->bl, clrtype);
if(merc_is_hom_active(sd->hd))
unit_remove_map(&sd->hd->bl, clrtype);
}[/font][/color]
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on May 1 2008, 09:58 AM[/b]
[color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002623/162345 (active=1 connect_new=0 rewarp=0 changemap=1 debug_remove_map=1) from map=alde_gld (users=2). Previous call from ..\src\map\unit.c:1821(unit_remove_map_pc), current call from ..\src\map\unit.c:1821(unit_remove_map_pc). Please report this!!!
[Debug]: unit_remove_map: unexpected state when removing player AID/CID:2002623/162345 (active=1 connect_new=0 rewarp=0 changemap=0 debug_remove_map=1) from map=aldeg_cas01 (users=1). Previous call from ..\src\map\unit.c:1821(unit_remove_map_pc), current call from ..\src\map\unit.c:1821(unit_remove_map_pc). Please report this!!![/font][/color]
Once again during WoE. For code-position, see previous post.
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on May 22 2008, 02:30 AM[/b]
[color=#003366][size=2]
I did a further extension of the debug message by myself, to figure out, what is calling unit_remove_map_pc. It turns out, that it is called from the same position in pc_setpos.
/src/map/pc.c:3609 (r12718)[/size][/color][color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
if( x < 0 || x >= map[m].xs || y < 0 || y >= map[m].ys )
{
ShowError("pc_setpos: attempt to place player %s (%d:%d) on invalid coordinates (%s-%d,%d)\n", sd->status.name, sd->status.account_id, sd->status.char_id, mapindex_id2name(mapindex),x,y);
x = y = 0; // make it random
}
if( x == 0 && y == 0 )
{// pick a random walkable cell
do {
x=rand()%(map[m].xs-2)+1;
y=rand()%(map[m].ys-2)+1;
} while(map_getcell(m,x,y,CELL_CHKNOPASS));
}
if(sd->bl.prev != NULL){
unit_remove_map_pc(sd,clrtype); // <-- Prev & current call [line:3609]
clif_changemap(sd,map[m].index,x,y); // [MouseJstr]
} else if(sd->state.active)
//Tag player for rewarping after map-loading is done. [Skotlex]
sd->state.rewarp = 1;[/font][/color]
[/font][font=Arial, Verdana, Tahoma,]
[b] Posted by: Ai4rei on Jun 10 2008, 06:04 AM[/b]
[color=#003366][size=2]
Once again digging this up, still cannot reproduce it intentionally, but could further track where both calls are coming from. Both calls start in unit_walktoxy_timer and go along through npc_touch_areanpc->pc_setpos->unit_remove_map_pc->unit_remove_map.
/src/map/unit.c (r127xx):[/size][/color][color=#000000][b]
CODE[/b][/color][color=#465584][font=Courier,]
static int unit_walktoxy_timer(int tid, unsigned int tick, int id, intptr data)
{
[...]
if(sd) {
if(map_getcell(bl->m,x,y,CELL_CHKNPC)) {
npc_touch_areanpc(sd,bl->m,x,y); // <--
if (bl->prev == NULL) //Script could have warped char, abort remaining of the function.
return 0;
} else
sd->areanpc_id=0;
if (sd->state.gmaster_flag &&
(battle_config.guild_aura&(agit_flag?2:1)) &&
(battle_config.guild_aura&(map_flag_gvg2(bl->m)?8:4))
)[/font][/color]
Dunno how to track it further, hope this may help.
[/font]