Large PHP Uploads Stall/Fail

dlewis23

Active Member
#1
I'm having a problem with large PHP uploads. For some reason I can't upload files greater then about 180 MB.

Right now I'm trying to upload a file that is 700 MB through PHP, but it seems to stall as soon as I start the upload. It will go to 0.03% and not any further. The transfer speed is super low, either 8 KB/s or 12 KB/s. My connection will do 180 KB/s.

I know the script works because If I switch back to Apache I can upload a 2 GB file with no problem. I have both PHP upload settings set to 2048 MB. 256 MB PHP memory limit.

Litespeed tmp is set to a second 1TB drive with plenty of free space for the uploads. I did a few searches on the forum but didn't really come up with any kind of solutions.

Does anyone have any settings or ideas for me to try?

Thanks
 

dlewis23

Active Member
#3
I saw that and looked through it. I am using his settings from his first post, I wasn't sure about the connection timeout at 10000 since I have a ton of small images being downloaded.

But I set them all the same. And still have the same problem.

Uploads also get really slow after a little bit of uploading. Im uploading a 200 MB file right now and it started at 175 KB/s and now its down to about 20 KB/s and I use users complaining about the same thing happening to them.
 

dlewis23

Active Member
#5
try 4.1RC4 or 4.1RC5, see if any difference.
Well I tried that, but it screwed everything up. All of my rewrite rules seemed to stop working, no one could download anything. So I had to completely uninstall litespeed, but I couldn't do that because I couldn't stop the litespeed service.

Had to restart, then uninstall, then reinstall lsws.

Is there anything else I should look into because Id rather not like to go thought that again and have an hour of downtime.
 

dlewis23

Active Member
#7
Try increase your memory_limit in php.ini to 512M and memory_limit (soft/hard) in lsphp5 to 500M.
That actually seemed to make it worse. I tried uploading a 700 MB file, and it started out uploading at full speed and correctly, but at about 7% into the upload it started to go very slow, about 20 KB/s and totally stopped at about 250 MB.
 

dlewis23

Active Member
#8
I think I made some progress on this.

In the isphp5 settings I changed the Max Connections to 250 and it seems to upload a lot better. I tested with a 700 MB file and it made it all the way to 97% then stalled again.

I looked at Real Time Stats and saw that the server had just restarted the uptime was at 2 minutes.

I think the main part of my problem is the Litespeed keeps restarting so a long upload can never finish.

Is there anything I can try on getting the server to not restart like its doing? I tried to fix this problem before but was not successful. I do have Graceful Restart Timeout set to -1.

Thanks
 

NiteWave

Administrator
#9
Had to restart, then uninstall, then reinstall lsws.
sorry, have cause so much trouble with you.

I assume you're not familiar with litespeed's version management feature.

it's
admin console->
Actions->
Version Manager

you can install multiple version litespeed on your sever, and switch between them by just one click in above page. and usually has 0 downtime.
in your case, you can install 4.0.20, 4.1RC4, 4.1Rc5 and switch between them without worrying about downtime.

what version you tried, 4.1RC4 or RC5 ?
 
#10
sorry, have cause so much trouble with you.

I assume you're not familiar with litespeed's version management feature.

it's
admin console->
Actions->
Version Manager

you can install multiple version litespeed on your sever, and switch between them by just one click in above page. and usually has 0 downtime.
in your case, you can install 4.0.20, 4.1RC4, 4.1Rc5 and switch between them without worrying about downtime.

what version you tried, 4.1RC4 or RC5 ?
I tried that, but I couldn't get it to switch back. I tried to switch back to 4.0.20 but when it did its restart it was still on 4.1RC5.

I did not try 4.1RC4, only 4.1RC5.

I just tried uploading a 700 MB file again and it went through all the way at full speed. And litespeed did not restart during the upload. The uptime is 1 hour 31 minutes. So I'm guessing that my problem is because litespeed keeps restating.

Thanks
 
#11
yes, need trace the root cause of litespeed restart. litespeed itself not restart often -- it must relate to the php scripts on your server.

do you have mod_security rules enabled? RC5 has big changes on support mod_security 2.5 rules. while RC4 and 4.0.20 is more compatible. it's not likely 4.1RC4 can't switch back to 4.0.20 and have to reinstall.
 

webizen

Well-Known Member
#12
after version switch, wait for a few seconds and refresh the page such as web console version manager page to see the new version. this is to let existing admin console php processes (on the old version) to exit and newly started php processes to detect the new version.
 
#13
yes, need trace the root cause of litespeed restart. litespeed itself not restart often -- it must relate to the php scripts on your server.

do you have mod_security rules enabled? RC5 has big changes on support mod_security 2.5 rules. while RC4 and 4.0.20 is more compatible. it's not likely 4.1RC4 can't switch back to 4.0.20 and have to reinstall.
I did have mod_security rules enabled. I turned them off temporarily to see if it helps with the restarting problem.

I looked through the log but nothing stands out in it when litespeed restarted, so I'm not sure where to even start looking to try and fix this problem.
 
#14
still recommend you test on 4.1RC4, or 4.1RC5+disable mod_security.

4.1 also has better support on upload progress bar which is a must when upload large files.
 
#15
still recommend you test on 4.1RC4, or 4.1RC5+disable mod_security.

4.1 also has better support on upload progress bar which is a must when upload large files.
I will try 4.1RC5 again with no mod_security and let you know.

But I'm not using the upload_progress php thing, I'm using a flash based uploader that just works with a regular PHP upload script.
 
#16
Letting you know I tried 4.1RC5 again with no mod_security and it caused the same problem. Totally messed up mod_rewrite so none of my pages would load.

I installed 4.1RC4 and that worked great. I'm running that right now and I will let you know if it continues to restart.
 

webizen

Well-Known Member
#18
Please do followings to help troubleshooting:

  1. Change 'graceful restart timeout' => 7200 (from -1)
  2. Enable debug logging to see what happen to the upload:
    • Enable debug logging (Web Console -> Configuration -> Server -> Log):
      Log Level: DEBUG
      Debug Level: MEDIUM or HIGH
      Graceful restart lsws to make it effective.
    • grep /usr/local/apache/logs/error_log with your IP address during the upload
 
Last edited:
#19
Please do followings to help troubleshooting:

  1. Change 'graceful restart timeout' => 7200 (from -1)
  2. Enable debug logging to see what happen to the upload:
    • Enable debug logging (Web Console -> Configuration -> Server -> Log):
      Log Level: DEBUG
      Debug Level: MEDIUM or HIGH
      Graceful restart lsws to make it effective.
    • grep /usr/local/apache/logs/error_log with your IP address during the upload
I tried that, but I don't see anything in the debug that is different from what was in the log before. I've been checking the error log and there is nothing while i'm uploading. And it still restarts.

I don't really have a problem with uploading I can get a file to finish and process correctly now, but I can't stop the server from restarting. Every time litespeed restarts it stalls the upload.
 
#20
litespeed restarting frequently is not normal -- usually it doesn't. it should relate to large file upload. let's work together to resolve this issue.

4.1RC4 just updated --- please do a "Force Reinstall".

to watch
1.do't restart frequently, or have some improvements

2.even restart, upload will complete without break.
 
Top