Issue information

Issue ID
#7646
Status
Fixed
Severity
None
Started
purityz
Aug 11, 2013 10:23
Last Post
Ind
Aug 14, 2013 15:42
Confirmation
N/A

purityz - Aug 11, 2013 10:23

if you're using reloadscript when they are a instance map that using battleground mapflag. mapserver will crash.

[code=auto:0]bat_c01 mapflag battleground 2 morocc,150,150,5 script testtestsss 1002,{ set .@id,instance_create("bg instance",0,IOT_NONE); instance_attachmap("bat_c01", .@id,1,"mymapname"); instance_init .@id; warp "mymapname",0,0; }[/code]

after clicking this npc, try to use @reloadscript then mapserver will crash.


also, I dont know if is this a bug.
I cannot creating[b] IOT_NONE[/b] <OwnerType> instance without player attach to a script.
if I do mapserver will report "script_rid2sd: [i]fatal error[/i] ! [i]player[/i] not [i]attached[/i]".



*****edit*****

if you do it this way
[code=auto:0] morocc,150,150,5 script testtestsss 1002,{ set .@id,instance_create("bg instance",0,IOT_NONE); instance_attachmap("bat_c01", .@id,1,"mymapname"); instance_init .@id; //set mapflag here setmapflag "mymapname",mf_battleground,2; warp "mymapname",0,0; } [/code]


it wont crash after @reloadscript

This post has been edited by purityz on Aug 11, 2013 15:49

purityz - Aug 11, 2013 15:29

also if you use [b]instance_attachmap[/b] like this
[quote]
instance_attachmap("prontera", .@id,1,"mymapname");[/quote]

after instance destroy or timeout. attached map are not remove, they're still in (maybe) MAPDB.

[code=auto:0]morocc,150,150,5 script testtestsss 1002,{ set .@id,instance_create("prontera instance",0,IOT_NONE); instance_attachmap("prontera", .@id,1,"mymapname"); //remove instance instance_detachmap "mymapname",.@id; instance_destroy .@id; }[/code]


using this script first time you click. it will create instance. attach prontera to that instance and named it "mymapname". In the end, remove them.
second times you click it will thow this error.

[quote]
[Error]: instance_add_map: trying to create instanced map with existent name 'mymapname'
[Error]: buildin_instance_attachmap: instance creation failed (prontera): -2[/quote]

This post has been edited by purityz on Aug 11, 2013 15:31

serverkid - Aug 12, 2013 0:13

this is probably related to mine. [url="http://herc.ws/board/tracker/issue-7636-map-server-crashing/"]http://herc.ws/board/tracker/issue-7636-map-server-crashing/[/url]

serverkid - Aug 12, 2013 0:28

could you please make a crash dump and post it here. it may help to fix the issue thanks! :)

purityz - Aug 13, 2013 17:21

this is a fix to problem that map are not being remove from mapdb after instance destroy.

in map.c[code=auto:0] void map_removemapdb(struct map_data *m) { index2mapid[m->index] = -1; } [/code]


to

[code=auto:0] void map_removemapdb(struct map_data *m) { index2mapid[m->index] = -1; if(strdb_iget(mapindex_db, m->name)){ strdb_remove(mapindex_db, m->name); } } [/code]

purityz - Aug 14, 2013 14:56

new information.

not only [b][i][u]mapflag battleground[/u][/i][/b] that make server crash.
also [b][i][u]mapflag gvg[/u][/i][/b].

Ind - Aug 14, 2013 15:42

Fixed in [url="https://github.com/HerculesWS/Hercules/commit/b4cf8f280cc5cdd027685fb6dd2a2c5692e12115"]https://github.com/HerculesWS/Hercules/commit/b4cf8f280cc5cdd027685fb6dd2a2c5692e12115[/url]
Thank you for all the scenarios. I fixed all the bugs to the extent I could debug, also fixed the player attached error you reported (it was due to the IOT constants being missing in db/const.txt, server thought they were player variables and that was why the rid2sd error came up)