Error_occurred error message, Database Problems

Hello,



I am using CS Cart v3.03 and Twigmo v2.5.



A few days ago I started receiving an “Error_ocurred” message in the client and admin when trying to load a new page.


  • The page source did show the page I was trying to load.
  • Refreshing the page would bring up the page properly.



    At around the same time, the CS Cart logs started showing this message:



    [color=#000000][font=Tahoma, Arial, Verdana,]Error: Incorrect key file for table './mydatabase/cscart_stored_sessions.MYI'; try to repair it (126)[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]Query: REPLACE INTO cscart_stored_sessions SELECT * FROM cscart_sessions WHERE 1 AND expiry < 1377639688 AND company_id = 3[/font][/color]



    The backtrace reported this:

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/mysite/public_html/core/fn.database.php (db_error): 267[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/core/classes/session.php (db_query): 167[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/core/classes/session.php (gc): 277[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/addons/twigmo/func.php (start): 1961[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/addons/twigmo/controllers/customer/twigmo.php (fn_twg_init_api_session_data): 596[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/addons/twigmo/controllers/customer/twigmo.php (fn_init_api_meta): 46[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/core/fn.control.php (include): 638[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/core/fn.control.php (fn_run_controller): 458[/font][/color]

    [color=#000000][font=Tahoma, Arial, Verdana,]/home/[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]mysite[/font][/color][color=#000000][font=Tahoma, Arial, Verdana,]/public_html/index.php (fn_dispatch): 22[/font][/color]



    There is reference to Twigmo which I upgraded 5 days before I noticed the problem.



    The error message said I should try to repair the cscart_stored_sessions which I did. The number of rows was reduced from 25877 to 18480.



    Because I can't reproduce the error at will, I am still waiting to see if the error has been fixed.



    I am hoping someone with knowledge of the code could tell me what might have been happening here and what the cscart_stored_sessions table does.



    Thanks.

You need to repair some tables in your database. Contact your host for help with that issue.

Ran that yesterday and it seems to have resolved the problem. Thanks.

Hello. The problem was caused by the error in your database. Twigmo uses session function, which interacts with the database. Such problem may occur in CS-Cart without Twigmo, too.

Problem is that the table continues to become corrupt and takes down my site. Running repair on that table brings it back up. I just need to know what my options are for this table. Have opened a support ticket.

Faster server and/or more file/memory space allocated to mysql. The problem is not with the application (cs-cart), it is with the instance of mysqld on your server. If you are on a shared server then move to a VPS. Otherwise, contact your host for guidance. It is not a cs-cart issue. No application can “cause” a table corruption.

Thanks for the clarification. fyi- I am at Hostgator on a VPS. If I remember correctly, you are on Hostgator too. Do you mind sharing which VPS plan you are on? Just wondering if I need to upgrade from Level 3.



Hostgator suggested I convert the table from MyISAM to InnoDB which I balked at figuring if the table should be InnoDB then CS Cart would have done this themselves. Running optimize on table to see if that helps.

don't know the actual plan. I would try adding memory to start with. You should not need to go to InnoDB, but it won't hurt anything.

Hi Novista,



Have you managed to solve this? If so how?

I am having the same issues with two tables in my DB that keep on crashing. Running REPAIR on them does the job but I need to do it every two days or so…

I have a dedicated server with 8GB of RAM so I don't think that memory allocation is the issue.



Any ideas?

The solution was to run REPAIR TABLE cscart_sessions; on the database and increase the RAM. I don't remember what else I might have done although I may have increased the memory limit in my php.ini file—memory_limit = 64M.



Hope that helps.

If your php code was executing a mysql operation at the time that you exceeded your 'memory_limit' then it's possible that it could have caused the corruption. But I believe this is more of a system memory issue than a php memory issue. mySQL is pretty resilient to application issues. But when it runs out of space in the system, it can have problems. If you're on a shared server, it could be another client that is chewing things up. All the more reason not to use a shared hosting plan.

[quote name='tbirnseth' timestamp='1403202237' post='186103']

If your php code was executing a mysql operation at the time that you exceeded your 'memory_limit' then it's possible that it could have caused the corruption. But I believe this is more of a system memory issue than a php memory issue. mySQL is pretty resilient to application issues. But when it runs out of space in the system, it can have problems. If you're on a shared server, it could be another client that is chewing things up. All the more reason not to use a shared hosting plan.

[/quote]



Thanks Tony. However, I am on a dedicated server with 8G of RAM without any other significant websites running on this server (and I manage all of these websites).

I added the following lines to my my.cnf file:

innodb_buffer_pool_size=5872025

key_buffer_size=10M



Also my php memory limit is set to 512M. I don't know if it's good or not, but that's how it is…



Don't know if it changes anything, but I will wait to see if there are any more crashes coming…

Out of the box, mySQL should configure itself for the server it is running on (I.e. underlying memory, etc.). Sounds like you have plenty of memory (of course this is dependent on number of simultaneous visitors). You should use SAR to get a picture of your peak load times and the resources being consumed. Work with your host or a Linux Guru to figure this one out.

Thanks. If the problem continues, I will probably search for a Linux expert to deal with it.

I ran into same error, after spending almost an hour trying to find what was broken on CS-Cart, I figured it was free space problem on the server. The server ran out of disk space.