Ini file with more than 100 entries under one key causes CTD

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

User avatar
KungFuHamster
a snow griffon
a snow griffon
Posts: 337
Joined: Wed Oct 02, 2002 7:47 am

Ini file with more than 100 entries under one key causes CTD

Post by KungFuHamster » Mon Jun 26, 2006 12:51 pm

I'm not 100% sure that it's not my macro code causing it, but I'm pretty positive. The crash occurs after the SQL connection is confimed, but before the first entry is listed. If I remove that 100th entry, it works fine, regardless of what that 100th entry is.

Code: Select all

Sub Main

/declare inifile string local
/declare i int local
/declare item string local
/declare humanpause

/varset inifile ${Ini[for-sale.ini,items]}
|/echo ${inifile}
|/echo ${Math.Calc[${inifile.Count[|]}-1]} items in the list.

/mqlog "${Time} Connecting to MySQL database and starting for-sale.mac"

/delay 2s

/sqlconnect host (deleted)

/delay 2s

:Main_Loop

/doevents

/echo Starting main loop.

/for i 1 to ${Math.Calc[${inifile.Count[|]}-1]}
  /varset item ${inifile.Arg[${i},|]}
  /varcalc humanpause ${Int[${Math.Rand[${item.Length}]}/7]}+8
  /echo Waiting ${Int[${humanpause}]} seconds while we type in "${item}"
  /delay ${humanpause}s
  /call Searching "${item}"
/next i

/mqlog "${Time} Done with query; waiting 15-20 minutes..."
/echo "${Time} Done with query; waiting 15-20 minutes..."
/delay ${Math.Rand[5]}m
/delay 15m
/mqlog "${Time} Restarting query..."
/goto :Main_Loop

/return
And here's a sample of my ini file.

Code: Select all

[items]
A Box of Abu-Kar Token=
A Black Knight=
A Blue Squire=
A Red Knight=
A Red Squire=
A White Crown=
Ambleshift's Amazing Automated Amalgamator Token=
Anklesmasher=
Apatite=
I got the example for reading the ini file from another macro in the forums.

I don't know if it's a peculiarity of the code I'm using to read the ini file or not, but if I exceed 100 items in the list, EQ crashes, bringing up the Sony blocked crashed box. I have experimented by adding and subtracting the lines in question; I have tried to be as methodical as possible.

dbg.txt

Code: Select all

[Mon Jun 26 10:46:44 2006]00248:fatal error in main thread Code = c0000005  ADDR=0x03006171

[Mon Jun 26 10:46:44 2006]00249:EAX=00000000  EBX=00000001  ECX=00000000  EDX=03085108

[Mon Jun 26 10:46:44 2006]00250:ESI=0c90f408  EDI=00000000  EBP=73696c61  ESP=0013d700

[Mon Jun 26 10:46:44 2006]00251:Raw Stack


(deleted a bunch of junk in here, including character name; if a dev needs it, I can PM it)


[Mon Jun 26 10:46:44 2006]00508:Call Stack

[Mon Jun 26 10:46:44 2006]00509:crashed doing call stack

[Mon Jun 26 10:46:44 2006]00510:Stack Scan

[Mon Jun 26 10:46:44 2006]00511:0x0013d710: ADDR=0x005d302c 

[Mon Jun 26 10:46:44 2006]00512:0x0013ded4: ADDR=0x005ded01 

[Mon Jun 26 10:46:44 2006]00513:0x0013df2c: ADDR=0x004c853a 

[Mon Jun 26 10:46:44 2006]00514:0x0013e678: ADDR=0x00682b5e 

[Mon Jun 26 10:46:44 2006]00515:0x0013e688: ADDR=0x005ceb75 

[Mon Jun 26 10:46:44 2006]00516:0x0013e694: ADDR=0x005cc5d9 

[Mon Jun 26 10:46:44 2006]00517:0x0013e69c: ADDR=0x005ceb86 

[Mon Jun 26 10:46:44 2006]00518:0x0013e6a8: ADDR=0x00954750 

[Mon Jun 26 10:46:44 2006]00519:0x0013e6b4: ADDR=0x00682b08 

[Mon Jun 26 10:46:44 2006]00520:0x0013e6bc: ADDR=0x004a77d6 

[Mon Jun 26 10:46:44 2006]00521:0x0013e6d0: ADDR=0x008a24f0 

[Mon Jun 26 10:46:44 2006]00522:0x0013e6d8: ADDR=0x00954750 

[Mon Jun 26 10:46:44 2006]00523:0x0013e6f0: ADDR=0x008a24f0 

[Mon Jun 26 10:46:44 2006]00524:0x0013e6fc: ADDR=0x0044cc6f 

[Mon Jun 26 10:46:44 2006]00525:0x0013e700: ADDR=0x00954750 

[Mon Jun 26 10:46:44 2006]00526:0x0013e708: ADDR=0x005b87a4 

[Mon Jun 26 10:46:44 2006]00527:0x0013e714: ADDR=0x005d91fa 

[Mon Jun 26 10:46:44 2006]00528:0x0013e718: ADDR=0x004c9fd7 

[Mon Jun 26 10:46:44 2006]00529:0x0013e71c: ADDR=0x00cd02be 

[Mon Jun 26 10:46:44 2006]00530:0x0013e720: ADDR=0x009e0158 

[Mon Jun 26 10:46:44 2006]00531:0x0013e770: ADDR=0x006609ee 

[Mon Jun 26 10:46:44 2006]00532:0x0013e774: ADDR=0x006696c1 

[Mon Jun 26 10:46:44 2006]00533:0x0013e77c: ADDR=0x00660a14 

[Mon Jun 26 10:46:44 2006]00534:0x0013e784: ADDR=0x00660a05 

[Mon Jun 26 10:46:44 2006]00535:0x0013e788: ADDR=0x006956f5 

[Mon Jun 26 10:46:44 2006]00536:0x0013e7a4: ADDR=0x0066174c 

[Mon Jun 26 10:46:44 2006]00537:0x0013e7ac: ADDR=0x0065f7e4 

[Mon Jun 26 10:46:44 2006]00538:0x0013e7b0: ADDR=0x006c1e88 

[Mon Jun 26 10:46:44 2006]00539:0x0013e7b8: ADDR=0x00660a05 

[Mon Jun 26 10:46:44 2006]00540:0x0013e7bc: ADDR=0x00665659 

[Mon Jun 26 10:46:44 2006]00541:0x0013e7c0: ADDR=0x006a33b0 

[Mon Jun 26 10:46:44 2006]00542:0x0013e7d0: ADDR=0x00674baa 

[Mon Jun 26 10:46:44 2006]00543:0x0013e7e0: ADDR=0x004ffdd6 

[Mon Jun 26 10:46:44 2006]00544:0x0013e7e4: ADDR=0x00cd02be 

[Mon Jun 26 10:46:44 2006]00545:0x0013e7ec: ADDR=0x005019b9 

[Mon Jun 26 10:46:44 2006]00546:fatal error in main thread Code = c0000005  ADDR=0x03006171

[Mon Jun 26 10:46:44 2006]00547:EAX=00000000  EBX=00000001  ECX=00000000  EDX=03085108

[Mon Jun 26 10:46:44 2006]00548:ESI=0c90f408  EDI=00000000  EBP=73696c61  ESP=0013d700

[Mon Jun 26 10:46:44 2006]00549:Process was trying to READ invalid data.

[Mon Jun 26 10:46:44 2006]00550:Invalid access occurred at virtual address 0x00000004.

[Mon Jun 26 10:46:44 2006]00551:Fatal error occurred in mainthread! (Release Client #630)

[Mon Jun 26 10:46:44 2006]00552:Client Version: Jun 15 2006 11:23:27
[Mon Jun 26 10:46:44 2006]00553:Skin Directory: (deleted)

[Mon Jun 26 10:46:44 2006]00554:Graphics DLL Loaded: Graphics DLL Version 2.00.0322
[Mon Jun 26 10:46:44 2006]00555:Graphics Build Date: Jun  9 2006 11:22:42
[Mon Jun 26 10:46:44 2006]00556:Video Card: NVIDIA GeForce 6600 GT , 6.14.10.8421

[Mon Jun 26 10:46:44 2006]00557:Crash (char = (deleted), zone = bazaar)

[Mon Jun 26 10:46:44 2006]00558:Local Player's World location at time of crash: (deleted)

[Mon Jun 26 10:46:44 2006]00559:Gamestate at crash = 5

(deleted processor info)

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 » Mon Jun 26, 2006 1:16 pm

You are limited to 2047 characters in a string. If you overflow, you crash.

User avatar
KungFuHamster
a snow griffon
a snow griffon
Posts: 337
Joined: Wed Oct 02, 2002 7:47 am

Post by KungFuHamster » Mon Jun 26, 2006 1:27 pm

Ok, I did see the MAX_STRING variable in the MQ2Data module, but wasn't sure if what I was doing would brush up against that.

It seemed like an odd coincidence that my macro was running up against it precisely at 100 entries. I'll split my list up into chunks, that should bypass the problem.

Thanks for the quick response, dkaa.

jimbo123
a ghoul
a ghoul
Posts: 87
Joined: Wed Dec 21, 2005 9:46 pm

Post by jimbo123 » Mon Jun 26, 2006 4:12 pm

I ran into the same problem, doing essentially the same thing, and used the same workaround. Now I see 'sqlconnect' in your code and it gives me a much better idea. If you are dumping the results to MySQL, why not just query your shopping list from there as well, one item at a time? I know that sounds bad when thinking of performance, but given the necessary human-like delays to keep from DOSing the bazaar server, the slow querying would not make an impact. -- No more breaking up the ini into multiple sections! whoot! I didn't even know you could create a database connection in MQ2 macros. Time for me to study up.

It will be oh-so-nice if some day MQ2 can read and write a line at a time to a plain text file. Maybe I'll write a plugin for that after I get smarter.

--jimbo

User avatar
KungFuHamster
a snow griffon
a snow griffon
Posts: 337
Joined: Wed Oct 02, 2002 7:47 am

Post by KungFuHamster » Mon Jun 26, 2006 4:58 pm

jimbo,

I had the same idea (ie, reading my list from the database as well) and I probably will eventually, but that's only if I keep my project going and it shows itself useful (obviously, profitable).

As for the sql portion, if you do a search on my most recent posts you'll see where I added a recent reply to a thread about the MySQL plugin. Everything you need to get the SQL plugin running is in that thread.

For sample scripts, do search on sqlconnect in the forums.