Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Memory issues with sales reporting Rate Topic   - - - - -

 
  • raceteam45
  • Junior Member
  • Members
  • Join Date: 03-May 07
  • 66 posts

Posted 07 December 2012 - 02:40 AM #1

I have launched 4 new CS-Cart 3.0.4 Professional websites, on two seperate servers in the last two weeks and each site has the same issues with reporting memory problems.

I can't even open the reports on one of my sites. I click on reports, wait a few minutes and i'm present with the following message

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 16 bytes) in /home/xxxxxx/public_html/xxxxxx/core/fn.common.php on line 542

Any ideas? Is there a fix?

I have several stores to purchase licenses for and migrate over, but i'm frankly worried about this.

I'm also having issues with the new import tool as well. Some sites it works and other not.

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 07 December 2012 - 04:23 AM #2

In Administration>Database>PHP Information, what is your servers 'memory_limit' set to? Are these values overriden by either htaccess rules or local php.ini, which will be in the public_html folder if it exists?

How much data are we talking? X Orders, X Customers, X Products?
Hire StellarBytes for CS-Cart Design & Development Services

 
  • raceteam45
  • Junior Member
  • Members
  • Join Date: 03-May 07
  • 66 posts

Posted 07 December 2012 - 03:31 PM #3

Memory Limit is set to 256Mb
317 orders / 101 customers / 200 Products

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 07 December 2012 - 06:39 PM #4

Something isn't right there then. I can load the reports on sites with more than tenfold those stats without any problems. Must be a problem with either your install, your database or your hosting. Best to get CS-Cart to investigate this for you.
Hire StellarBytes for CS-Cart Design & Development Services

 
  • raceteam45
  • Junior Member
  • Members
  • Join Date: 03-May 07
  • 66 posts

Posted 10 December 2012 - 12:25 PM #5

Definitely something going here. I started support ticket, hopefully we'll hear back soon.

 
  • raceteam45
  • Junior Member
  • Members
  • Join Date: 03-May 07
  • 66 posts

Posted 13 December 2012 - 10:08 AM #6

Mikhail sent me a sql file to reset the report settings, and we have reports back now.

The memory issue only on seems to occur when we select a time period of a month or more regardless of how much data there is.

It may also be worth pointing out that it is happening on every site that we have running CS-Cart 3.0.4, regardless of server, or server configurations.

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 13 December 2012 - 01:23 PM #7

I just converted a site from Interspire to CS-Cart, with virtually all data migrated via ######### as well as manually exporting/importing data into the database.

Using 3.0.4 Ultimate, I checked the reports to see if the data matched what was shown in Interspire, which it was. Reports ran fine for all order data going back to the beginning of the site in 2006.
Hire StellarBytes for CS-Cart Design & Development Services

 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 845 posts

Posted 13 December 2012 - 05:02 PM #8

I get a 404 when I try to run Sales Reports.
There are no errors in CS-Cart logs and no errors in server logs. I don't know what is causing this, but Sales Reports have always had a problem near the end of the year when the annual data would be at the maximun. But the volume is really not that high.

CS-Cart Ultimate v 4.15.1 (SP2)


 
  • HallMarc
  • Newbie
  • Trial users
  • Join Date: 10-Jan 13
  • 7 posts

Posted 10 January 2013 - 04:36 PM #9

OK here is what I has been found in the core/fn.sales_reports.php file.
This is for CS-Cart Pro v3.0.4 and you may find the same in earlier versions since I see this bug has been making the rounds.

In the file core/fn.sales_reports.php around line 72 (or do a search for
$time_end += ($intervals['0']['interval_id'] == '7') ? (mktime(0, 0, 0, date("m", $time_end) + 1, 1, date("Y", $time_end)) - $time_end) : $temp['value'];

and replace the mktime with gmmktime et viola. Works as it should now.

 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 845 posts

Posted 11 January 2013 - 10:18 PM #10

I'm in GMT -05 time zone and support had to make an additional change to the same line just to get reports to run:
$time_end += ($intervals['0']['interval_id'] == '7') ? (gmmktime(0, 0, 0, date("m", $time_end) + 1, 3, date("Y", $time_end)) - $time_end) :

Now the problem is with the starting and ending dates of reports, order searches, the customer's birthday and the sales amounts on the dashboard.

I've discovered that if I leave the line as:
$time_end += ($intervals['0']['interval_id'] == '7') ? (gmmktime(0, 0, 0, date("m", $time_end) + 1, 1, date("Y", $time_end)) - $time_end) :

Then, when I change my Time Zone to GMT -01 thru GMT -09 (in Settings > Appearance) Today includes yesterday, for all time intervals selected.
It appears as though when selecting GMT +01 thru GMT +13, Today includes tomorrow for all time intervals.
Only if you select GMT (Greenwich Mean TIme) are all time intervals correct - even the Dashboard totals.

I opened a ticket on this issue and am waiting to see what changes.

CS-Cart Ultimate v 4.15.1 (SP2)


 
  • ndrake55
  • Newbie
  • Members
  • Join Date: 14-Jan 13
  • 2 posts

Posted 14 January 2013 - 11:01 PM #11

I ended up changing back to "mktime" and it will now run reports when I have the (GMT -08:00) set to pacific standard time:

$time_end += ($intervals['0']['interval_id'] == '7') ? (mktime(0, 0, 0, date("m", $time_end) + 1, 1, date("Y", $time_end)) - $time_end) : $temp['value'];

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 01 March 2013 - 07:01 PM #12

I have a multisite client with this issue (out of memory).
Can anyone publish the actual SQL that was referenced in message #6?
I'm guessing there is a DB issue that is causing this to suck down the machine versus the time specification (should work with all times if the DB is correct).

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 845 posts

Posted 02 March 2013 - 03:40 PM #13

UPDATE cscart_sales_reports SET period = 'D';
UPDATE cscart_sales_reports_table_elements SET limit_auto = '20';

All you are doing is resetting the report period to Daily.
I find that when I choose Last Year from the report's drop down, it will time out and I have to go in and reset the period so I can bring the report back up. I can run quarterly reports on last year that don't cause this to happen, so I just stopped using "Last Year".

Also, CS-Cart undid the changes that implemented gmmktime. One of the last updates to v3 fixed a discrepancy where gmmktime was still being called. All the time/date values are using mktime. That fixed the bug with customer's birthdays too.

CS-Cart Ultimate v 4.15.1 (SP2)


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 02 March 2013 - 05:19 PM #14

I hacked the following solution. This is entered just below the gmmktime line:
// EZms hack for infinate loop
if( $time_end == $temp['time_from'] )
    $time_end += $temp['value'];
// EZms end hack
Since the memory issue seems to be an infinite loop where $time_to is always greater than $time_end when using the monthly report (the default and the trigger for the gmmktime function - interval_id == 7 for monthly report).

Don't have time to debug this properly. But then that should be cs-cart's job anyway.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Magpie Don
  • Senior Member
  • Members
  • Join Date: 01-Apr 09
  • 845 posts

Posted 03 March 2013 - 09:38 PM #15

You're not editing ver 3.0.5 or greater are you? gmmktime was replaced universally with mktime in v3.0.5. There was a bug where gmmktime was still being called in one or two places - even though mktime was already used in the rest of the code. It threw off all dates by -1 day (including reports, orders lists, dashboard totals, customers DOB).

CS-Cart Ultimate v 4.15.1 (SP2)


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 12156 posts

Posted 04 March 2013 - 03:31 AM #16

These are 3.0.4 sites.... All I know is that the "out of memory" was caused by an infinate loop. I can deal with the 1 day variance in months (other than Feb) and like I said, I don't have time to figure out the "right" solution for this.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • cheerup
  • Newbie
  • Trial users
  • Join Date: 16-Jul 13
  • 1 posts

Posted 16 July 2013 - 11:03 PM #17

I just started getting the Fatal error today but my fn.sales_reports.php already has mk and not gmmk (version 2.0.9). Has anyone found a fix for this? I have scoured these forums all day today but have not found a concrete answer. Here is my error when I try to log in as admin:
Fatal error: Allowed memory size of 1048576000 bytes exhausted (tried to allocate 262117 bytes) in /home/x/public_html/core/fn.log.php on line 70
Can anyone help?