If this is your first visit, check our documentation. To post, register or login.
Forums / Upgrading from 1.3.x to 1.3.9 / download timeout

download timeout

Locked

Started by deesee on 19 Sep 2009, 11:22 PM · Views: 6,953

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
19 Sep 2009, 11:22 PM
#1
deesee avatar

deesee

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

download timeout

listed in the bugfixes for 1.3.8a is:

"BugFix: changed download timeout to 20 minutes if server allows it, to aid in larger downloads not ending prematurely"

is there more information on this? what exact value - and where - was changed?

this is a problem on my site, so i'd love to know more about how this was fixed.

20 Sep 2009, 1:37 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

changed download timeout to 20 minutes if server allows it
20 minutes of cpu will get you suspended on most shared hosting

Get with your host and find out the environmrnt setup they provide.
Assuming you are on a linux server, how/what is the php handler?
Some of the options are:
as a module
DSO
Fastcgi
suphp

Zen-Venom Get Bitten

20 Sep 2009, 3:44 PM
#3
deesee avatar

deesee

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: download timeout

kobra:

20 minutes of cpu will get you suspended on most shared hosting

Get with your host and find out the environmrnt setup they provide.
Assuming you are on a linux server, how/what is the php handler?
Some of the options are:
as a module
DSO
Fastcgi
suphp

what is the 20 minutes related to, though (what process/processes)? would this mean that downloads must take 20 minutes or less to complete successfully?

i am hosting audio sample libraries, and my files are quite large (>1GB, even after breaking it up into smaller bits), so I need to be able to reliably provide downloads for my customers. right now, that's not the case.

i have been getting around this by manually providing customers with a shared/protected web folder which contains the files - and it works for them every time - but obviously that's no where close to an ideal solution.

i am on a linux host, and i'm using PHP4 with CGI/FastCGI

thanks.

20 Sep 2009, 3:48 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

i am on a linux host, and i'm using PHP4 with CGI/FastCGI
Is this yours or shared??

Most TOS's for shared hosting have something akin to up to 25% CPU for no more than 3 min or less.

Zen-Venom Get Bitten

20 Sep 2009, 5:02 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: download timeout

deesee:

"BugFix: changed download timeout to 20 minutes if server allows it, to aid in larger downloads not ending prematurely"
That relates to this line in /includes/modules/pages/download/header_php.php:```
// override PHP timeout to 20 minutes, if allowed
@set_time_limit(1200);

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

20 Sep 2009, 8:44 PM
#6
deesee avatar

deesee

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: download timeout

DrByte:

That relates to this line in /includes/modules/pages/download/header_php.php:```
// override PHP timeout to 20 minutes, if allowed
@set_time_limit(1200);


ah ha!  thank you, drbyte :)

so, i have redirect set to FALSE and streaming set to FALSE, but my customers are still experiencing downloads that end prematurely (no errors given, they just stop, as if they are finished).

do you have any idea what could be causing this?

again, if i give my customers a login/password to a protected web folder i have created, they are able to download with no problems - so i am sure it's not an http issue.

it almost seems as if somehow an incorrect filesize value is being passed to the browser?
20 Sep 2009, 10:17 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: download timeout

deesee:

so, i have redirect set to FALSE and streaming set to FALSE
Why ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Sep 2009, 12:21 AM
#8
deesee avatar

deesee

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: download timeout

DrByte:

Why ?

i tried both redirect and stream and both resulted in incomplete downloads.

i set both to false to try and eliminate places for error.

21 Sep 2009, 12:23 AM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Re: download timeout

Using Download By Redirect is the same as using http like you mentioned before. All it does is create a download point, and points the customer to that to do the download the same as if they'd clicked a link you supplied in an email.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

21 Sep 2009, 5:31 PM
#10
deesee avatar

deesee

New Zenner

Join Date:
Sep 2009
Posts:
5
Plugin Contributions:
0

Re: download timeout

DrByte:

Using Download By Redirect is the same as using http like you mentioned before. All it does is create a download point, and points the customer to that to do the download the same as if they'd clicked a link you supplied in an email.

apparently not, as the alternate (outside/separate from zen cart) links i provide to customers works every time.

just to be sure i wasn't crazy, i switched redirect to TRUE, made sure /pub was 777, throttled my bandwidth to 50k/s (to be sure it'd take a long time to download), and as predicted, the download ended prematurely after only 57MB.

this is a serious problem :(

11 Nov 2009, 3:55 PM
#11
stride_r avatar

stride_r

Zen Follower

Join Date:
Aug 2008
Posts:
115
Plugin Contributions:
0

Re: download timeout

After much struggles in getting my client's downloads to complete successfully - (some zip files are over 50MB and many were timing out before completion), I finally worked out the issue with the help of this thread.

My Hosting company (which i cannot say enough good things about) worked diligently with us to sort out any issues that may have been on their end. However, after much testing with the Firefox "Throttler" add-on (to slow downloads and simulate a dial-up customer's experience) we were still experiencing problems with incomplete downloads ending abruptly at around 20 minutes!

This thread finally held the answer. Despite no mention of this limitation in the Zen Cart "Download delivery methods explained" tutorial, the fact is that Zen Cart comes hard coded for a max time of 20 mins. Upping this was our answer!

Please, Please, add a reference to this fact in the Tutorial: https://www.zen-cart.com/tutorials/index.php?article=292
so that others can be saved untold time and frustration. :frusty:

Maybe a future ZC version should have this value somewhere within the Admin so it's more easily discovered? Just a thought...

Otherwise, thanks for a great product and instruction.:smile:

11 Mar 2010, 7:20 AM
#12
orcasoul avatar

orcasoul

Zen Follower

Join Date:
Jan 2010
Posts:
133
Plugin Contributions:
0

Re: download timeout

stride-r:

After much struggles in getting my client's downloads to complete successfully - (some zip files are over 50MB and many were timing out before completion), I finally worked out the issue with the help of this thread.

My Hosting company (which i cannot say enough good things about) worked diligently with us to sort out any issues that may have been on their end. However, after much testing with the Firefox "Throttler" add-on (to slow downloads and simulate a dial-up customer's experience) we were still experiencing problems with incomplete downloads ending abruptly at around 20 minutes!

This thread finally held the answer. Despite no mention of this limitation in the Zen Cart "Download delivery methods explained" tutorial, the fact is that Zen Cart comes hard coded for a max time of 20 mins. Upping this was our answer!

Please, Please, add a reference to this fact in the Tutorial: https://www.zen-cart.com/tutorials/index.php?article=292
so that others can be saved untold time and frustration. :frusty:

Maybe a future ZC version should have this value somewhere within the Admin so it's more easily discovered? Just a thought...

Otherwise, thanks for a great product and instruction.:smile:

I'm having a very similar problem with a customer using dial-up to download a 5 MB file - it times out at about 20 minutes.

Where is this 20 minute limit set, and how do I change it?

11 Mar 2010, 7:46 AM
#13
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

OrcaSoul:

Where is this 20 minute limit set, and how do I change it?
I suspect tht it is a php parameter and not a ZenCart setting

Zen-Venom Get Bitten

11 Mar 2010, 7:58 AM
#14
orcasoul avatar

orcasoul

Zen Follower

Join Date:
Jan 2010
Posts:
133
Plugin Contributions:
0

Re: download timeout

kobra:

I suspect tht it is a php parameter and not a ZenCart setting

OK, I just did some searching of the entire Zen Cart installed code using CEDIT, and came across something that looks like it may be where it happens:

Starting at line 143 in includes/modules/pages/download/header_php.php

if (DOWNLOAD_BY_REDIRECT != 'true' or $link_create_status==false ) {
  // not downloading by redirect; instead, we stream it to the browser.
  // This happens if the symlink couldn't happen, or if set as default in Admin
  header("Content-Length: " . (string)$zv_filesize);
  if (DOWNLOAD_IN_CHUNKS != 'true') {
    // This will work on all systems, but will need considerable resources
    $zco_notifier->notify('NOTIFY_DOWNLOAD_WITHOUT_REDIRECT___COMPLETED');
    readfile(DIR_FS_DOWNLOAD . $origin_filename);
  } else {
    // override PHP timeout to 20 minutes, if allowed
    //@set_time_limit(1200);
    @set_time_limit(4800);	// test at 1 hr, 20 min for dialup.

Note the last 2 lines, where I set the limit to 4800.

I set an email to him to test this, should know by tomorrow if this works.

If it does, I'll want to copy this to the appropriate folder in modules/orcatools/pages/ to be sure it'll override any updates.

I'll let you know how it goes.

11 Mar 2010, 8:04 AM
#15
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

If it does, I'll want to copy this to the appropriate folder in modules/orcatools/pages/ to be sure it'll override any updates
There is no "classic" folder under /pages - - so these are not overrideable

Nice find but note "if allowed"

Zen-Venom Get Bitten

11 Mar 2010, 4:58 PM
#16
vger avatar

vger

Past Contributor

Join Date:
Nov 2004
Location:
Norfolk, United Kingdom
Posts:
3,189
Plugin Contributions:
0

Re: download timeout

That code also doesn't test at 20 minutes but at 1 hour and 20 minutes:

80x60(seconds)=4800seconds.

Downloadable products is a minefield and there's nothing simple at all about it.

Older versions of IE will only handle downloads up to 2 Gbs in size. Newer versions wil handle 4 Gbs. Google Chrome handles downloads in the same way as IE.

Firefox will handle any size of download, but if you use the "Pause" button in Firefox it actually means starting all over again from the beginning.

The size of file which PHP can handle will depend on the number of bytes which need to be read and 32 bit systems will be able to handle fewer bytes being read than 64 bit systems will.

Then there's the not so small matter of whether servers wll permit "Download by redirect" to work. The more scecure the server the less likely you will be to be able to use this feature - as it needs to create symbolic links in the pub folder "on the fly".

Vger

11 Mar 2010, 10:10 PM
#17
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

Vger:

That code also doesn't test at 20 minutes but at 1 hour and 20 minutes:
That was their edit to increase time

    // override PHP timeout to 20 minutes, if allowed
    //@set_time_limit(1200);
    @set_time_limit(4800);	// test at 1 hr, 20 min for dialup.

Zen-Venom Get Bitten

12 Mar 2010, 12:38 AM
#18
orcasoul avatar

orcasoul

Zen Follower

Join Date:
Jan 2010
Posts:
133
Plugin Contributions:
0

Re: download timeout

Vger:

That code also doesn't test at 20 minutes but at 1 hour and 20 minutes:

80x60(seconds)=4800seconds.

Downloadable products is a minefield and there's nothing simple at all about it.

Older versions of IE will only handle downloads up to 2 Gbs in size. Newer versions wil handle 4 Gbs. Google Chrome handles downloads in the same way as IE.

Firefox will handle any size of download, but if you use the "Pause" button in Firefox it actually means starting all over again from the beginning.

The size of file which PHP can handle will depend on the number of bytes which need to be read and 32 bit systems will be able to handle fewer bytes being read than 64 bit systems will.

Then there's the not so small matter of whether servers wll permit "Download by redirect" to work. The more scecure the server the less likely you will be to be able to use this feature - as it needs to create symbolic links in the pub folder "on the fly".

Vger

Since he was getting the Zen Cart timeout message, I don't think it's his browser (and he tried it on both FF & IE, with the same result). And I checked with Godaddy and received this response:

Thank you for contacting online support. We do not place a download limit on the account. However, if the download is being processed via script, you may need to adjust the max_execution_time in your php.ini file. As your account is using php5 the file will need to be called php5.ini.

So it looks like it's related to ZC...

12 Mar 2010, 12:49 AM
#19
orcasoul avatar

orcasoul

Zen Follower

Join Date:
Jan 2010
Posts:
133
Plugin Contributions:
0

Re: download timeout

kobra:

There is no "classic" folder under /pages - - so these are not overrideable

Nice find but note "if allowed"

Understood - but there is one in the same folder. As I understand over-riding, if I have a includes/modules/orcatools/pages/download/ path this will over-ride the existing includes/modules/pages/download/ files.

Or am I confused...again? :lookaroun

12 Mar 2010, 3:44 AM
#20
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: download timeout

OrcaSoul:

As I understand over-riding, if I have a includes/modules/orcatools/pages/download/ path this will over-ride the existing includes/modules/pages/download/ files.

Or am I confused...again?

Tutorial:

Wherever you see a folder named "classic" you can safely add your own /CUSTOM folder.
As there is no existing classic folder directly under /pages - - They are not overrideble
https://www.zen-cart.com/tutorials/index.php?article=143
https://www.zen-cart.com/tutorials/index.php?article=230

Zen-Venom Get Bitten