views:

362

answers:

2

I have a WAMP 2.0 server installed on Win XP . Apache version : 2.2.11 PHP Version : 5.3 MySQL : 5.1.36

I have about 11 tables in the mysql . Each run of my web application (HTML/Jquery/PHP/MySQL) fills about 100 rows in 2 of the tables.(One of the table has 2 Long blob columns where data of size upto 20MB is uploaded, I have changed the Max_allowed_packet size to 32M in my.ini file )

THe application works fine for about 3 weeks until the number of rows in one of the table reaches >1500 .

THen I see the httpd crash message (Apache httpd encountered error and needs to close )and it says illegal memory refernce Please find below some logs

szAppName : httpd.exe     szAppVer : 2.2.11.0     szModName : php5ts.dll     
szModVer : 5.3.0.0     offset : 0000c309     


C:\DOCUME~1\blrcom\LOCALS~1\Temp\WERc677.dir00\httpd.exe.mdmp
C:\DOCUME~1\blrcom\LOCALS~1\Temp\WERc677.dir00\appcompat.txt

If I clear the two tables (1500 > rows ). Still the problem is seen .

I am using PDO PHP to update the tables.

Can anyone guide me as this is becoming a blocker.

Regards, Mithun

A: 

There are lots of possible reasons why this is happening. Are you keeping an array of all the 20 MB objects in memory? As that grows you could be increasing the per process size of apache to the point where you are out of memory.

hypermiler
+1  A: 

PROBLEM:

I have a suspicion that you are hitting a 2gb file size wall. 2 problems with your setup:

  • First problem: You are running this one windows.
  • Second problem: You are running this on windows. :-)

REASON:

Jokes aside. Mysql stores data in its root folder ( for instance C:\Program Files\MySQL\MySQL Server 5.0\data ). Each subfolder corresponds to a db in you instance of mysql. Inside each folder there a file with extension .frm which corresponds to your tables. See if the table you are storing your uploads in is approaching a 2 GB limit. Considering that you have a column that store uploads UP TO 20 Mb * 1500 rows - that is roughly around 2 GBs ( assuming most of you files are smaller than 20 MB) Unfortunately Windows XP has really hard time dealing with files bigger than 2GB - limitations of the file system and OS. It is the same reason people get in trouble with their outlook - because they don't sort or clean their emails.

SOLUTION:

Third problem - You are storing binary data in a db - never a good idea. Store it on disk - and just keep reference to it ( name or path) in your db. Or you can keep your current setup for a while if you move to *nix system that supports larger file sizes. But this is still a bad idea to store binary data of that size in your DB directly. It also makes your DB searches slower, and backups MUCH slower ( since there is no easy incremental backup in mysql)

Hope that helps.

EDIT:

I forgot to mention since you are using WAMP, you mysql folder would be in your wamp installation folder. By default I think it should be in c:\wamp\mysql\data - but I don't remember for sure. I use xampp when on windows, usually.

Nick Gorbikoff