4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: Instigator on March 10, 2006, 02:31:45 AM

Title: Weird problem when downloading from 4images
Post by: Instigator on March 10, 2006, 02:31:45 AM
This is a strange problem which i've noticed just now.

I download a file (hosted locally) be it small or large and while that file is downloading I can't browse other pages. As soon as I stop the download that page loads up. It's like my connection is being queued by 4images  :(

I tested this with both I.E and mozilla. Other softwares on my site such as IPB and VB work fine. i.e I can download the attachments and simultenously browse other pages. So I don't think this is a server problem as it is my server is highly optimized and poweful.

Did anyone have this problem or still have it? Any solutions for this?

Title: Re: Weird problem when downloading from 4images
Post by: max.cady on March 10, 2006, 07:12:57 AM
Why don't you just upload your files via ftp to the relevant category folder? Then the upload won't have any impact on your browser.
Title: Re: Weird problem when downloading from 4images
Post by: max.cady on March 10, 2006, 08:20:04 AM
should have had finished my morning coffee ... before posting ... you mean download not upload.
What kind of files are you downloading ... jpg's? How big are the files?
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 10, 2006, 11:46:38 AM
should have had finished my morning coffee ... before posting ... you mean download not upload.
What kind of files are you downloading ... jpg's? How big are the files?

mp3s and .avis. all files above 1mb
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 12, 2006, 01:51:37 PM
Can anyone help plz?  :(
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 14, 2006, 02:17:17 AM
I'm getting desperate guys :( Let me keep it simple.

While a file is downloading on the gallery no other pages can be surfed. Any solutions for this?
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 14, 2006, 03:45:22 AM
Have you tryed different computer?
I'd guess something wrong with yours...
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 14, 2006, 02:00:21 PM
Have you tryed different computer?
I'd guess something wrong with yours...

Um what has computer got to do with it? No offence but I'm confused. fyi I tried on 3 different browsers, I.E, mozilla and opera. All same effect :( I just can't browse my gallery when there is a download going on :(
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 14, 2006, 02:42:39 PM
Um what has computer got to do with it?
lets see....only you have this problem, nobody else ever reported it, I think thats enough to asume there is something wrong with your computer...
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 14, 2006, 04:18:57 PM
Hmm ok i'll try it on another computer and report back  :oops:
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 14, 2006, 06:38:18 PM
Hi veno,

I tried it on 2 other computers and the same problem. So I can conclude its either due to the server setup or the 4images script. The mods I've added are Dynamic Title and Search engine friendly urls. I think the next thing u will suggest is to try a default 4images installation  :lol: So I am going to do that now and report back to u  :!:
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 14, 2006, 10:04:28 PM
I tried the default installation and it gives the same problem so it looks like a server problem. Can u suggest what could be causing this problem? I have only edited my httpd.conf and my.cnf file for optimisation.
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 15, 2006, 02:15:55 AM
hmmm...what if you try the default httpd.conf ? (doubt my.cnf is related to this issue)

Any additional non-standart modules for apache or php?

[EDIT]
I think I know what do you mean, I also noticed that when I open my pphlogger page which takes about 1-2 minutes to open, I can not use the same domain to browes other pages...I thought it was windows limitation of some kind...never tryed to investigate it...
But, your case is little different, because file data is being sent out to the browser, while in my case the browser waiting for server responce...

Sorry dont have an answer..
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 15, 2006, 01:16:15 PM
Mod security and Mod bandwidth installed but modbandwidth is not applied to the domain in question. Also have Eaccelerator php cache engine installed.
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 15, 2006, 02:45:01 PM
Then try disable mod security (which, by the way, people reported as a troublesome...)
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 15, 2006, 04:54:20 PM
Yep I tried that already few hours ago and no effect. Any other suggestions?  :cry:
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 16, 2006, 02:00:12 AM
Where I can test it?
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 16, 2006, 11:47:15 AM
I've sent you a pm with the link veno :)
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 16, 2006, 01:52:43 PM
Ok, it seems to be problem in PHP or MySQL settings...
cause if you download file directly (not by clicking download button), you can browse the site just fine while its being downloaded...

So, I guess, try to remove my.cnf and restore php.ini to the default state. (do one step at the time, and test it after each step and obviously you must restart apache and mysql on each change in the configuration) also, try to use default settings for the web server itself.

And then, if nothing worked, try this code:
http://www.4homepages.de/forum/index.php?topic=10755.msg54465#msg54465
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on March 17, 2006, 07:07:04 PM
I tried that code already on the main site of the link i gave u. It did help with the serverload but the problem of connections being queued was still there.

It will be difficult to revert back to original php and my.cnf settings with the server hosting many sites and the files having some optimzations. I'll have a think of what changes I made exactly and try removing them one by one.
Title: Re: Weird problem when downloading from 4images
Post by: V@no on March 18, 2006, 12:33:20 AM
If so, you could always run two apache servers simulteniously on two different ports, that way you can test it without interupting other sites...
if apache/php settings wont make any difference, then the only thing left is database configuration...atleast it would be easier to pin-point the problem ;)


good luck, let us know if you find the cause.
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 01, 2006, 05:37:07 PM
Hi Veno,

I have found the cause of the problem. It's something to do with the session/cookie. I download a file and then delete my cookies. I can then browse the site normally. I even login again and can surf the site and even download another file. BUT then I can't surf the site again. So I have to delete cookies again to browse site.

So how do I fix this problem? :(
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 05, 2006, 11:41:41 AM
Tried default php.ini - no effect
my.cnf - no effect.
tried also downgrading php to one we had previosuly. no effect.
turned off firewall. no effect
looking through httpd.conf i can't see anything that would effect.

can't think of anything else :(

Any suggestions?  :oops:
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 05, 2006, 02:50:29 PM
just try the default httpd.conf
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 05, 2006, 06:17:06 PM
Just tried that too Veno. No effect :( I am getting desperate now.

As I mentioned earlier while I am downloading a large file (logged in) I delete my cookies and then I can browse as guest. I can then even login again and download another file simultenously but then can't browse the site. The cause is something related to the sessionID/cookie information. It's like each user is limited to one request per session id.
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 05, 2006, 11:53:27 PM
Problem fixed! I changed the value in php.ini

session.save_handler=files

to

session.save_handler=mm

So sessions are now stored in memory rather then files.

EDIT: NOW my site just shows blank page. I've reverted back to the sessions files. So I'm back to where I started from :(
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 06, 2006, 01:51:41 AM
hmm...this is interesting...wonder what if you change session.save_path ? (make sure that folder exists and writible by the web server user)
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 06, 2006, 02:44:22 AM
Yes I already tried that Veno few days ago. It has no effect. I have been reading up on this from google searches and it seems the problem is concurrent access for particular sessionid. It's like the sessionid is locked when file is downloading and only after download is finished can one browse the site.

Placing the sessions data in memory helped to solve problem temporary but then the problem of blank pages happened.

Any other suggestions?  :(
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 06, 2006, 02:51:15 AM
ok, we are getting close...but the strange thing is that once 4images output the file content, apache become responsible of delivering it to the client, it should release the php session because php is not in use anymore...your case is very strange...but we are getting close ;)
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 06, 2006, 11:09:34 AM
Ok I have an idea. As the problem I'm having is related to one sessionID how about changing the code so that a new session is created for every access? This would mean a large session table but then I can have a low session cleanup value to get ride of idle sessions quickly.
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 06, 2006, 02:47:42 PM
then, what is the point of having sessions? ;) its not going to work like that...

but have you tryed v1.7.2? same problem?
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 06, 2006, 03:23:12 PM
Just tried 1.7.2 and have the same problem :(
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 09, 2006, 02:17:40 PM
Sorry for being a nuisance but I really need help on this cos I'm at a dead-end :(
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 09, 2006, 10:30:27 PM
I dont have an answer for you...in fact so far nobody could answer this question on any of the forums I've asked...
and some people insist that they dont have such problem
i.e. http://www.codingforums.com/showthread.php?t=84007
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 10, 2006, 12:50:43 AM
Hi Veno,

Thanks for your help. I will check that thread regularly myself and look elsewhere for an answer.

Thanks!
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 10, 2006, 01:21:35 AM
Yes!! I have figured it out thanks to google :p

The fix is:

Before:
Code: [Select]
if (get_user_os() == "MAC") {
Add
Code: [Select]
session_write_close();
Source: http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/ and http://uk2.php.net/session_write_close

Edit: Sorry the file is download.php.
Explanation: In short the session data was not being written when download was in progress so the session was "locked" and could not be used. Using the write_close() function it meant that before the download starts the session data is written and made available. The inspiration was thanks to Veno who used the word "Lock up" and I used same on google to find my answer :D

thanks veno :D
Title: Re: Weird problem when downloading from 4images
Post by: V@no on April 10, 2006, 01:26:25 AM
omg! great find!
Title: Re: Weird problem when downloading from 4images
Post by: Instigator on April 10, 2006, 01:27:24 AM
Added explanation :D Hope it helps :)