Issue information

Issue ID
#7368
Status
Fixed
Severity
None
Started
Haru
Jun 15, 2013 2:22
Last Post
Mysterious
Jun 15, 2013 16:53
Confirmation
N/A

Haru - Jun 15, 2013 2:22

[code=auto:0]Program received signal SIGSEGV, Segmentation fault. clif_PartyBookingVolunteerInfo (index=167412752, sd=0x42) at clif.c:12529 12529 WBUFL(buf, 2) = sd->status.account_id; (gdb) bt full #0 clif_PartyBookingVolunteerInfo (index=167412752, sd=0x42) at clif.c:12529 buf = "\362\b\000\000\000\000\000\000\000\324\060\300\264\354\356\377\277\066\304\024\b\347\t\000\000\000@\000\000\000\000\000\000\020\204\372\t" #1 0x081f86fc in buyingstore_setup (slots=<optimized out>, sd=0x9fa8410) at buyingstore.c:80 No locals. #2 buyingstore_setup (sd=0x9fa8410, slots=5 '\005') at buyingstore.c:49 No locals. #3 0x0817117b in skill_castend_nodamage_id (src=0x9fa8410, bl=0x9fa8410, skill_id=2535, skill_lv=1, tick=1476880191, flag=0) at skill.c:7702 sd = <optimized out> dstsd = <optimized out> md = <optimized out> dstmd = 0x0 hd = <optimized out> mer = 0x0 sstatus = 0x9fa8660 tstatus = 0x9fa8660 tsc = 0x9fa86b0 tsce = 0x0 i = <optimized out> type = SC_NONE #4 0x0815763c in skill_castend_id (tid=-1, tick=1476880191, id=2000000, data=0) at skill.c:4830 target = <optimized out> src = 0x9fa8410 sd = <optimized out> md = 0x0 ud = 0x9fa8428 sc = <optimized out> inf = <optimized out> inf2 = <optimized out> flag = 0 #5 0x081ef439 in unit_skilluse_id2 (src=0x9fa8410, target_id=2000000, skill_id=2535, skill_lv=1, casttime=0, castcancel=0) at unit.c:1394 ud = 0x9fa8428 tstatus = 0x9fa8660 sc = 0x0 sd = 0x9fa8410 target = 0x9fa8410 tick = 1476880191 temp = <optimized out> range = <optimized out> __FUNCTION__ = "unit_skilluse_id2" #6 0x081efa87 in unit_skilluse_id (src=0x9fa8410, target_id=2000000, skill_id=2535, skill_lv=1) at unit.c:881 No locals. #7 0x08097b45 in clif_parse_UseSkillToId (fd=10, sd=0x9fa8410) at clif.c:11384 skill_id = <optimized out> skill_lv = <optimized out> tmp = <optimized out> target_id = 2000000 tick = 1476880191 #8 0x08088d55 in clif_parse (fd=10) at clif.c:17572 cmd = <optimized out> packet_len = 10 sd = 0x9fa8410 pnum = <optimized out> #9 0x08205266 in do_sockets (next=100) at socket.c:810 rfd = {__fds_bits = {1024, 0 <repeats 31 times>}} timeout = {tv_sec = 0, tv_usec = 43897} ret = <optimized out> i = <optimized out> #10 0x080708b8 in main (argc=1, argv=0xbffff3a4) at core.c:347 next = <optimized out> (gdb) up #1 0x081f86fc in buyingstore_setup (slots=<optimized out>, sd=0x9fa8410) at buyingstore.c:80 80 clif->buyingstore_open(sd); (gdb) list 75 ShowWarning("buyingstore_setup: Requested %d slots, but server supports only %d slots.\n", (int)slots, MAX_BUYINGSTORE_SLOTS); 76 slots = MAX_BUYINGSTORE_SLOTS; 77 } 78 79 sd->buyingstore.slots = slots; 80 clif->buyingstore_open(sd); 81 82 return true; 83 } 84 (gdb) print clif->buyingstore_open $1 = (void (*)(struct map_session_data *)) 0x8089d20 <clif_buyingstore_open> (gdb) print clif_buyingstore_open $2 = {void (struct map_session_data *)} 0x8089d20 <clif_buyingstore_open> (gdb) print clif_PartyBookingVolunteerInfo $3 = {void (int, struct map_session_data *)} 0x809c470 <clif_PartyBookingVolunteerInfo> [/code]Quite an odd backtrace at a first glance.

Why would buyingstore_setup call clif_PartyBookingVolunteerInfo instead of clif_buyingstore_open?

Git bisect comes to rescue.
It's in [url="https://github.com/HerculesWS/Hercules/commit/4a51fc7e5eec9a464c754d3d1e0ee44da1ca6f72"]commit 4a51fc7[/url], src/config/const.h:[code=auto:0]diff --git a/src/config/const.h b/src/config/const.h index 53f24da..756c681 100644 --- a/src/config/const.h +++ b/src/config/const.h @@ -92,7 +92,10 @@ #else #define MAX_CARTS 5 #endif - +/* Client Supports Party Recruit or Party Booking? */ +#if (PACKETVER == 20120410) || (PACKETVER == 20120418) + #define PARTY_RECRUIT +#endif// Renewal variable cast time reduction #ifdef RENEWAL_CAST #define VARCAST_REDUCTION(val){ \ [/code]Testing PACKETVER in config/const.h doesn't seem a wise thing to do, being PACKETVER defined in common/mmo.h, which cannot be assumed to be always #include'd before config/const.h.

Specifically, as of today (634bcc6):
chat.c, trade.c, vending.c, homunculus.c, mercenary.c, instance.c, searchstore.c, duel.c, elemental.c don't include common/mmo.h before including config/core.h.
This causes a mismatch between the clif_interface versions as seen by the different sources, since clif_interface has a different definition depending on PARTY_RECRUIT.

I think:
- Either move the offending code to common/mmo.h or include common/mmo.h from config/const.h, since relying on the include order doesn't seem really robust.
- Is it fine to have a different interface definition depending on the server's settings, considering that it is also exported to the HPM?

mkbu95 - Jun 15, 2013 6:28

Please update with b745cb176a16e771bf5bbae43a7445cf160d1342 and see if it works. Thanks for reporting.

Haru - Jun 15, 2013 13:44

I confirm the issue is fixed in b745cb1, thank you very much.

In case you want to look at it, there's still an occurrence of PACKETVER check in config/const.h though (related to the NEW_CARTS definition; blame goes to [url="https://github.com/HerculesWS/Hercules/commit/7a612f8db0c03ba748a174c97e9bc2cf902d8b10"]7a612f8 / rAthena r16297[/url]). While that doesn't currently cause troubles (it's currently only used in source files that include common/mmo.h before config/core.h), it might end up introducing another subtle, hidden problem like this one later on.

Mysterious - Jun 15, 2013 16:53

Fixed in [url="https://github.com/HerculesWS/Hercules/commit/b745cb176a16e771bf5bbae43a7445cf160d1342"][color=rgb(40,40,40)][font=helvetica, arial, sans-serif][size=3]b745cb176a16e771bf5bbae43a7445cf160d1342[/size][/font][/color][/url]