Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance Issue #4363

Closed
RadianFord opened this issue Sep 21, 2019 · 26 comments · Fixed by #5922 or teenshowstep/rathena#73
Closed

Instance Issue #4363

RadianFord opened this issue Sep 21, 2019 · 26 comments · Fixed by #5922 or teenshowstep/rathena#73
Labels
component:core A fault that lies within the main framework of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode priority:high A fault that makes rAthena unstable or unusable type:bug Issue that is a bug within rAthena

Comments

@RadianFord
Copy link
Contributor

  • Client Date: 2017-06-14bRagexeRE
  • Server Mode: Pre renewal
  • Description of Issue: A random map crashed on running an instance.
#0  map_addblock (bl=bl@entry=0x55df955de810) at map.cpp:355
        m = 990
        y = 95
        x = 97
        pos = 287
        mapdata = <optimized out>
        bl = 0x55df955de810
        m = <optimized out>
        y = <optimized out>
        x = <optimized out>
        pos = <optimized out>
        mapdata = <optimized out>
        m = <optimized out>
        x = <optimized out>
        y = <optimized out>
        pos = <optimized out>
        mapdata = <optimized out>
#1  0x000055df8f846c27 in clif_parse_LoadEndAck (fd=<optimized out>,
    sd=0x55df955de810) at clif.cpp:10375
        guild_notice = false
        mapdata = 0x55df902154a0 <map+5433120>
#2  0x000055df8f815ea5 in clif_parse (fd=11) at clif.cpp:21209
        cmd = <optimized out>
        packet_len = 2
        sd = <optimized out>
        pnum = 0
        cmd2 = -930076505
#3  0x000055df8f7bbc25 in main ()
@SmashRO
Copy link

SmashRO commented Sep 22, 2019

+1 to this issue

@Anjuts
Copy link

Anjuts commented Sep 22, 2019

+1

@sader1992
Copy link
Contributor

it would be better if each one put his own crash log , not +1
also more information would be better , not only the crash log.

@RadianFord
Copy link
Contributor Author

The issue with this is it happens randomly.

  1. It can happened when player enters the instance.
  2. Sometimes even creating instance it crashed the map-server.

@cydh
Copy link
Contributor

cydh commented Sep 23, 2019

something that worse to read

  • google translation result
  • coredump output with all <optimized out> messages because the compilation flag is -O2

@Radio-Gagaa
Copy link

Radio-Gagaa commented Nov 26, 2019

Also getting crashes which we believe might be related to this issue. It's a bit hard to pinpoint where it happens as it only happens every few weeks or so, and a lot of things are happening at the time of the crash.

Anyway, for what it's worth:

rAthena Hash: 34e5f53

Client Date: 2017-06-14bRagexeRE

Server Mode: Pre renewal

#0  0x000055589de1cf8d in map_getcellp (cellchk=CELL_CHKNOSAVE, y=<optimized out>, x=<optimized out>, m=0x55589e7c8a48 <map+7490440>) at map.cpp:3222
        i = 30660
        cell = <optimized out>
        i = <optimized out>
        cell = <optimized out>
        __FUNCTION__ = "map_getcellp"
#1  map_getcellp (m=0x55589e7c8a48 <map+7490440>, x=<optimized out>, y=<optimized out>, cellchk=CELL_CHKNOSAVE) at map.cpp:3208
        i = <optimized out>
        cell = <optimized out>
        __FUNCTION__ = "map_getcellp"
#2  0x000055589de54c06 in pc_makesavestatus (sd=sd@entry=0x5558a6c08a50) at pc.cpp:819
        __FUNCTION__ = "pc_makesavestatus"
#3  0x000055589ddb2173 in chrif_save (sd=0x5558a6c08a50, flag=flag@entry=25) at chrif.cpp:298
        mmo_charstatus_len = 0
        __FUNCTION__ = "chrif_save"
#4  0x000055589de160be in map_abort_sub(map_session_data *, typedef __va_list_tag __va_list_tag *) (sd=<optimized out>, ap=<optimized out>) at map.cpp:5093
No locals.
#5  0x000055589de1ab40 in map_foreachpc (func=func@entry=0x55589de160b0 <map_abort_sub(map_session_data *, typedef __va_list_tag __va_list_tag *)>) at map.cpp:2392
        args = {{gp_offset = 8, fp_offset = 48, overflow_arg_area = 0x7ffd870ac6a0, reg_save_area = 0x7ffd870ac5c0}}
        ret = <optimized out>
        iter = 0x7fd68889172c
        sd = 0x5558a6c08a50
#6  0x000055589de20d64 in do_abort () at map.cpp:5118
        run = 1
#7  0x000055589dfa6de5 in sig_proc (sn=<optimized out>, sn=<optimized out>) at core.cpp:116
        is_called = 0
#8  <signal handler called>
No locals.
#9  0x000055589de165d1 in map_addblock (bl=0x5558a6c08a50) at map.cpp:369
        m = 1355
        y = 109
        x = 140
        pos = 472
        mapdata = 0x55589e7c8a48 <map+7490440>
        m = <optimized out>
        x = <optimized out>
        y = <optimized out>
        pos = <optimized out>
        __FUNCTION__ = "map_addblock"
        mapdata = <optimized out>
#10 map_addblock (bl=bl@entry=0x5558a6c08a50) at map.cpp:331
        m = <optimized out>
        x = <optimized out>
        y = <optimized out>
        pos = <optimized out>
        mapdata = <optimized out>
        __FUNCTION__ = "map_addblock"
#11 0x000055589ddef402 in clif_parse_LoadEndAck (fd=<optimized out>, sd=0x5558a6c08a50) at clif.cpp:10459
        guild_notice = false
        mapdata = 0x55589e7c8a48 <map+7490440>
#12 0x000055589ddbc2f4 in clif_parse (fd=289) at clif.cpp:21203
        cmd = <optimized out>
        packet_len = 2
        sd = <optimized out>
        pnum = 0
        cmd = <optimized out>
        packet_len = <optimized out>
        sd = <optimized out>
        pnum = <optimized out>
#13 clif_parse (fd=289) at clif.cpp:21073
        cmd = <optimized out>
        packet_len = <optimized out>
        sd = <optimized out>
#14 0x000055589dd59ab5 in do_sockets (next=20) at socket.cpp:1352

@teededung
Copy link
Contributor

Annotation 2020-01-05 210505

I noticed that whenever someone crashes, an instance has just been destroyed. Maybe this is a clue to fix the error.

@admkakaroto
Copy link
Contributor

Well, crash and more crash =(

@Atemo
Copy link
Contributor

Atemo commented Jan 18, 2020

A potential cause could be dst_map->iwall_num = src_map->iwall_num; in

dst_map->iwall_num = src_map->iwall_num;

Comment just this line then give feedback please

@RadianFord
Copy link
Contributor Author

@Atemo im still getting the crashed.

@hotspicy945
Copy link

hotspicy945 commented Jan 28, 2020

A potential cause could be dst_map->iwall_num = src_map->iwall_num; in

dst_map->iwall_num = src_map->iwall_num;

Comment just this line then give feedback please

This crash almost happen in instance_destory

I guess
Client send packet trigger parse_LoadEndAck => map_addblock

But in the map_addblock function
struct map_data *mapdata = map_getmapdata(m);
m value still the instance map id , it should be savemap id

In map_delinstancemap function

if (mapdata->block)
		aFree(mapdata->block);

maybe problem in variable m is wrong?
So map_addblock got wrong mapdata , mapdata->block already release

@RadianFord
Copy link
Contributor Author

I noticed it too, that it happens when the instance has been destroyed.

@aleos89
Copy link
Contributor

aleos89 commented Jan 29, 2020

	// Kick everyone out
	map_foreachinmap(map_instancemap_leave, m, BL_PC);

This gets called before the clearing of the map's block data on instance destruction. It kicks all online players on that map out to their save points.

map_instancemap_leave -> pc_setpos -> set bl.m to destination m.

@hotspicy945
Copy link

@aleos89
Yes , It shold be do that.
But I don't know why crash.
I had
1.Full .dmp
2.my src (view dump neew my src)
3.instance file
Did you need thoes file?
Thank you!
My server today crash about 5 times... all this crash

@RadianFord
Copy link
Contributor Author

This issue is very random, Im not sure how or what happened. I thought it was just me but others are experiencing this issue too.

@sonniez
Copy link

sonniez commented Jul 11, 2020

from latest rathena(5cc391b) still randomly crash :(

@Kreustoo
Copy link
Contributor

Kreustoo commented Jul 27, 2020

Not the lastest rathena

#0  0x00000000004be658 in map_addblock (bl=bl@entry=0x5424330) at map.cpp:405
        m = 1095
        y = 72
        x = 108
        pos = 355
        bl = 0x5424330
#1  0x00000000004998e8 in clif_parse_LoadEndAck (fd=<optimized out>, 
    sd=0x5424330) at clif.cpp:10651
        guild_notice = false
        mapdata = 0xf47258 <map+5965560>
        __FUNCTION__ = "clif_parse_LoadEndAck"
#2  0x00000000004658a9 in clif_parse (fd=13) at clif.cpp:22266
        cmd = 125
        packet_len = 2
        sd = 0x5424330
        pnum = 1
#3  0x00000000006273bd in do_sockets (next=<optimized out>) at socket.cpp:1407
        rfd = {fds_bits = {8192, 0 <repeats 15 times>}}
        timeout = {tv_sec = 0, tv_usec = 19995}
        ret = 0
        i = 13
#4  0x000000000040746d in main (argc=1, argv=0x7fffffffe928) at core.cpp:369
        next = <optimized out>

So maybe it's not fully related, but it may help. It happened after a instance being destroyed too.

Happened on a custom instance.

@aleos89
Copy link
Contributor

aleos89 commented Sep 3, 2020

diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index da270e2ff..de7906895 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -10538,6 +10538,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 
 	struct map_data *mapdata = map_getmapdata(sd->bl.m);
 
+	if (mapdata->block == nullptr) { // Map block data is destroyed
+		pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+		return;
+	}
+
 	if(battle_config.pc_invincible_time > 0) {
 		if(mapdata_flag_gvg(mapdata))
 			pc_setinvincibletimer(sd,battle_config.pc_invincible_time<<1);

Could you guys try this out for me?

@RadianFord
Copy link
Contributor Author

diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index da270e2ff..de7906895 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -10538,6 +10538,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 
 	struct map_data *mapdata = map_getmapdata(sd->bl.m);
 
+	if (mapdata->block == nullptr) { // Map block data is destroyed
+		pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+		return;
+	}
+
 	if(battle_config.pc_invincible_time > 0) {
 		if(mapdata_flag_gvg(mapdata))
 			pc_setinvincibletimer(sd,battle_config.pc_invincible_time<<1);

Could you guys try this out for me?

I'm not sure why this crash is randomly happening on a custom instance script and also if running this alone will not crashed anything it requires a lot of people to run it.

@hnomkeng
Copy link

diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index da270e2ff..de7906895 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -10538,6 +10538,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
 
 	struct map_data *mapdata = map_getmapdata(sd->bl.m);
 
+	if (mapdata->block == nullptr) { // Map block data is destroyed
+		pc_setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
+		return;
+	}
+
 	if(battle_config.pc_invincible_time > 0) {
 		if(mapdata_flag_gvg(mapdata))
 			pc_setinvincibletimer(sd,battle_config.pc_invincible_time<<1);

Could you guys try this out for me?

I testing.

@hnomkeng
Copy link

hnomkeng commented Feb 26, 2021

#0  0x000000000040be1d in pc_setpos (clrtype=<optimized out>, y=75, x=232,
    mapindex=<optimized out>, sd=0x7fffb890)
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/ext/new_allocator.h:89
89            ~new_allocator() _GLIBCXX_USE_NOEXCEPT { }
(gdb) bt full
#0  0x000000000040be1d in pc_setpos (clrtype=<optimized out>, y=75, x=232,
    mapindex=<optimized out>, sd=0x7fffb890)
    at /opt/rh/devtoolset-9/root/usr/include/c++/9/ext/new_allocator.h:89
        curr_map_instance_id = 71
        new_map_instance_id = <optimized out>
        m = 128
        mapdata = <optimized out>
        sc = 0x7fffbe68
#1  pc_setpos (sd=0x7fffb890, mapindex=<optimized out>, x=232, y=75,
    clrtype=<optimized out>) at pc.cpp:6004
No locals.
#2  0x00000000004bd3a0 in clif_parse_LoadEndAck (fd=<optimized out>,
    sd=0x7fffb890) at clif.cpp:10780
        guild_notice = false
        mapdata = 0x122ed40 <map+10504064>
#3  0x0000000000485ef6 in clif_parse (fd=1417) at clif.cpp:22651
        cmd = 125
        packet_len = 2
        sd = 0x7fffb890
        pnum = 0
#4  0x00000000006b0f6d in do_sockets (next=next@entry=20) at socket.cpp:1411
        rfd = {fds_bits = {0, 0, 0, 4, 0, 0, 0, 0, 0, 2199023255552, 0, 0,
            2147483648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 0 <repeats 137 times>}}
---Type <return> to continue, or q <return> to quit---
        timeout = {tv_sec = 0, tv_usec = 19524}
        ret = <optimized out>
        i = 1417
#5  0x000000000041b817 in main (argc=<optimized out>, argv=<optimized out>)
    at core.cpp:382
        next = 20

@aleos89 Have issue on pc_setpos

@Badarosk0
Copy link

Has anyone found a solution? Even if temporary to resolve?

@Radio-Gagaa
Copy link

map.cpp > map_addblock

What we did here was check if mapdata is NULL or mapdata->block is NULL. If so, throw an error and return 1.

We haven't crashed since.

@Badarosk0
Copy link

Are the people who reported this problem using this PR?
#3753

@Radio-Gagaa
Copy link

Are the people who reported this problem using this PR?
#3753

Not in our case.

@RadianFord
Copy link
Contributor Author

map.cpp > map_addblock

What we did here was check if mapdata is NULL or mapdata->block is NULL. If so, throw an error and return 1.

We haven't crashed since.

Maybe show what you did, and devs can check it why its crashing?

@aleos89 aleos89 added component:core A fault that lies within the main framework of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode priority:high A fault that makes rAthena unstable or unusable status:confirmed Issue that has been validated by a developer to affect rAthena type:bug Issue that is a bug within rAthena labels May 6, 2021
aleos89 added a commit that referenced this issue May 6, 2021
* Fixes #4363.
* Resolves players warping to freed maps resulting in a crash.
* Clear out the instance_id from mapdata when clearing.
Thanks to everyone who reported and helped get to the bottom of the issue!
aleos89 added a commit that referenced this issue May 6, 2021
* Fixes #4363.
* Resolves players warping to freed maps resulting in a crash.
* Clear out the instance_id from mapdata when clearing.
Thanks to everyone who reported and helped get to the bottom of the issue!
@aleos89 aleos89 removed the status:confirmed Issue that has been validated by a developer to affect rAthena label May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:core A fault that lies within the main framework of rAthena mode:prerenewal A fault that exists within the pre-renewal mode mode:renewal A fault that exists within the renewal mode priority:high A fault that makes rAthena unstable or unusable type:bug Issue that is a bug within rAthena
Projects
None yet