CTD bug in MQ2Map

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

CTD bug in MQ2Map

Post by Mckorr » Wed Dec 03, 2003 8:14 pm

Fresh dev CVS. Compiled in Release, got a CTD when entering world.. well, more like a lockup. So I recompiled in Debug, made sure only MQ2ChatWnd was loaded initially, attached the debugger, and started loading modules one at a time.

Loaded MQ2Map. Loaded fine, and since I was using a completely clean build no mapfilters were enabled. I should add that the labels in the map window were turned on initially, but even with them off I got the same results:

/mapfilter all show -- no problem
/mapfilther npc show -- CRASH
HEAP[eqgame.exe]: Invalid Address specified to RtlValidateHeap( 010B0000, 03FEB460 )
Unhandled exception at 0x77f75a58 in eqgame.exe: User breakpoint.
Autos:
__active_heap 0x00000001 int
_crtheap 0x010b0000 void *
_osver 0x00000a28 unsigned int
pUserData 0x03feb480 const void *
Locals
pUserData 0x03feb480 const void *
Call Stack
kernel32.dll!77e6c75a()
> MQ2Main.dll!_CrtIsValidHeapPointer(const void * pUserData=0x03feb480) Line 1807 C
MQ2Main.dll!_free_dbg_lk(void * pUserData=0x03feb480, int nBlockUse=0x00000001) Line 1132 + 0x9 C
MQ2Main.dll!_free_dbg(void * pUserData=0x03feb480, int nBlockUse=0x00000001) Line 1070 + 0xd C
MQ2Main.dll!free(void * pUserData=0x03feb480) Line 1025 + 0xb C
MQ2Map.dll!ClearMapAllocs() Line 261 C++
MQ2Map.dll!OnPulse() Line 94 C++
MQ2Main.dll!PulsePlugins() Line 228 C++
MQ2Main.dll!Detour_ProcessGameEvents() Line 238 C++
eqgame.exe!004a4ff5()
Disassembly
1796: for (i = 0; (base = _heap_regions._regbase) != NULL &&
1797: i < _HEAP_REGIONMAX; i++)
1798: {
1799: if (pUserData >= base && pUserData <
1800: (void *)(((char *)base)+_heap_regions._currsize))
1801: return TRUE;
1802: }
1803:
1804: return FALSE;
1805:
1806: #endif /* WINHEAP */
1807: }
03031246 8B E5 mov esp,ebp
03031248 5D pop ebp
03031249 C3 ret
--- No source file -------------------------------------------------------------
0303124A CC int 3
0303124B CC int 3
0303124C CC int 3
0303124D CC int 3
0303124E CC int 3
0303124F CC int 3
--- f:\vs70builds\9466\vc\crtbld\crt\src\dbgheap.c -----------------------------
1808:
1809:
1810: /***
1811: *int _CrtIsMemoryBlock() - verify memory block is debug heap block
1812: *
1813: *Purpose:
1814: * verify memory block is debug heap block
1815: *


with the problem occuring where the Assembly code starts.

I'll now repeat the experiment with the zip file and see how that goes.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Dec 03, 2003 8:36 pm

Same problem with latest zip file. /mapfilter npc show causes a crash.
HEAP[eqgame.exe]: Invalid Address specified to RtlValidateHeap( 010E0000, 012DBE60 )
Unhandled exception at 0x77f75a58 in eqgame.exe: User breakpoint.
Call Stack
kernel32.dll!77e6c75a()
> MQ2Main.dll!_CrtIsValidHeapPointer(const void * pUserData=0x012dbe80) Line 1807 C
MQ2Main.dll!_free_dbg_lk(void * pUserData=0x012dbe80, int nBlockUse=0x00000001) Line 1132 + 0x9 C
The memory address is slightly different using the zipfile version, but then I did forget to remove all the plugins from the default MacroQuest.ini :oops: Crash is caused by the same condition however, turning on npc's in /mapfilter.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Dec 03, 2003 8:41 pm

How did you compile?

Mq2map.dll is linked against the static debug crts. Bad. The debug versions check the "tombstones" at the begining and end of each heap block. Consequently, you can free anything that wasn't allocated in via debug malloc.

We should be using the non-debug, multithreaded dll for crts.

addicted.to.eq
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Dec 03, 2003 8:29 pm

Post by addicted.to.eq » Wed Dec 03, 2003 8:52 pm

Hello all.

Confirming what Mckorr wrote, used the .ZIP file and compiled it with Visual C++ .NET Version 7.0.9514

Deleted all relevant dirs and files from previous versions before.

Operating System: Windows 2000 Service Pack 4, German, including all relevant updates.

After using "/mapfilter all" and than "/mapfilter pc" i got a CTD immediately.

A window popped up: Microsoft Visual C++ Debug Library
Debug Assertion failed!
Program c:\Everquest\eqgame.exe
File: dbgheap.c
Line: 1132

Expression: _CrtIsValidHeapPointer(pUserData)

I pressed "Ignore", got the following:

Line: 1200

Expression: _pFirstBlock == pHead

Some more "Ignore" will result in those two error messages a few times, until finally i got a memory written error.

Hopefully this will help a bit to check it out.

Oh, and MQ2-20031128a.zip will also result in a CTD when activating "/mapfilter ground". Most of the other functions will work, still testing.

Found this error as i searched for mapfilter in the forums here, only a reminder :)

Oh, and please excuse some grammars or typos, english is not my natural born language :)

Hakuna Matata!

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Dec 03, 2003 8:58 pm

I started seeing this issue after the MQMalloc and MQFree changes were added to the dev cvs.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Dec 03, 2003 9:06 pm

In mq2main/mq2main.vcproj

change
RuntimeLibrary="1"

to
RuntimeLibrary="0"

clean and rebuild.


Or use the makefile....
Last edited by dont_know_at_all on Wed Dec 03, 2003 9:07 pm, edited 1 time in total.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Dec 03, 2003 9:06 pm

dont_know_at_all wrote:How did you compile?

Mq2map.dll is linked against the static debug crts. Bad. The debug versions check the "tombstones" at the begining and end of each heap block. Consequently, you can free anything that wasn't allocated in via debug malloc.

We should be using the non-debug, multithreaded dll for crts.
I originally found the problem with my own personal build. I subsequently went back and got a fresh dev CVS, and got the same behavior in both Release and Debug modes. I repeated for the latest zip file, compiled out of the box using the included solution file.

Using either a Release build or a Debug build I get the same results, crash when doing a /mapfilter npc show. I didn't try PC, and Ground has had issues for a while. The only filters turned on were all, then npc.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Dec 03, 2003 9:08 pm

how did you manage to recompile in debug? you dont want to do that ;)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Dec 03, 2003 9:24 pm

Doesn't matter. Changing RunTimeLibrary to 0 fixed the crash. New problem though, now with any mapfilters turned on I get stutter step. Adjusting /mapfilter refresh changes this, but basically every time the map updates the screen momentarily freezes.

That's just using /mapfilter all show and /mapfilter npc show. Triggers and PC's don't seem to have that problem, but then again there aren't many PC's in the zone right now.

BTW, you can see the clouds pausing momentarily everytime the map refreshes, so it's easy to judge the rate.

Yet another edit, it doesn't matter if the map is open or not, same stuttering effect.

addicted.to.eq
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Dec 03, 2003 8:29 pm

Post by addicted.to.eq » Wed Dec 03, 2003 9:33 pm

Hey Mckorr, you are always one step faster than me :)

Maybe the time is the reason, it is 3:30 am now in Germany, yawn... :)

But to become serious again...all your points are fully confirmed by my tests. All filters working, but the performance
is soo going down that you can't even look at the screen without getting nervous :)


Very exciting, this.... (looks at the clock again...)


Hakuna Matata!

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Wed Dec 03, 2003 9:38 pm

'cept I'm off to bed myself. Will continue tomorrow if one of the others doesn't beat me to it.

BTW, /unload is causing CTD as well :?

addicted.to.eq
decaying skeleton
decaying skeleton
Posts: 4
Joined: Wed Dec 03, 2003 8:29 pm

Post by addicted.to.eq » Wed Dec 03, 2003 9:44 pm

Yeah....


Never found such a quick method to stop EQ from running than using "/unload" :wink: and MQ2 still active in SystemTray.

Anyway. good idea to go to bed now. Sleep well all.


Hakuna Matata!

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Dec 03, 2003 9:57 pm

this bug and /unload fixed, grab latest.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0