logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Crash while uploading large file Apache 2.4 FCGI PHP7
Author
Solune - NRE



Joined: 01 Mar 2018
Posts: 3
Location: France

PostPosted: Fri 02 Mar '18 11:08    Post subject: Crash while uploading large file Apache 2.4 FCGI PHP7 Reply with quote

Hi,

I'm actually encountering a problem while uploading large file.
I would like to upload files up to 2 GB but I encounter difficulties from 1 GB.

While uploading I see progression stops in the browser.
Windows performance monitor shows an increase of memory of about 1GB then stops abruptly.

When uploading a 950 MB file it is OK

Processor monitoring looks like that :
File is loaded in memory, processed, PHP moves the file then memory is freed
Code:
        ______________
       /              \___
      /                   \___
_____/                        \___________


While uploading 1GB file it doesn't work
Code:

       __
      /  |
     /   |
____/    |________________________________



It randomly provide this Apache error
[crit] Memory allocation failed, aborting process.

When I lauch httpd.exe manually I randmoly obtain "httpd.exe application errors "0x077ed770" memory cannot be read"
I increased system virtual memory size to 2048 but nothing changed.


error.log show that Apache auto restart when upload fails
Code:
[Thu Mar 01 16:19:04.145379 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00428: Parent: child process 8332 exited with status 3221225477 -- Restarting.
[Thu Mar 01 16:19:05.184105 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00455: Apache/2.4.29 (Win32) mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Mar 01 16:19:05.184105 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00456: Apache Lounge VC15 Server built: Nov  3 2017 10:30:36
[Thu Mar 01 16:19:05.184105 2018] [core:notice] [pid 4816:tid 556] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Thu Mar 01 16:19:05.184105 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00418: Parent: Created child process 8304
[Thu Mar 01 16:19:07.270523 2018] [mpm_winnt:notice] [pid 8304:tid 540] AH00354: Child: Starting 150 worker threads.
[Thu Mar 01 16:20:33.642687 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00428: Parent: child process 8304 exited with status 3221225477 -- Restarting.
[Thu Mar 01 16:20:35.364746 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00455: Apache/2.4.29 (Win32) mod_fcgid/2.3.9 configured -- resuming normal operations
[Thu Mar 01 16:20:35.364746 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00456: Apache Lounge VC15 Server built: Nov  3 2017 10:30:36
[Thu Mar 01 16:20:35.364746 2018] [core:notice] [pid 4816:tid 556] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Thu Mar 01 16:20:35.368750 2018] [mpm_winnt:notice] [pid 4816:tid 556] AH00418: Parent: Created child process 8952



I newly installed the lasted tools provided and recommended by Apache Lounge, searched everywhere on the web, did the basic configs params...
Browse Apache , MPM and FCGI documentations and forums...
What shall I do ?
What did I miss in the config ?
How to monitor what happening ?

Uploading with a WampServer32 wich use PHP through a DLL (not fcgid) works well up to 2GB files.


Here is the config I tried :

Last version of each tools :

  • Apache 2.4.29 Win 32 VC15 04 November 2017 (https://www.apachelounge.com/download/)
  • FCGID 2.3.9 Win 32 VC15 25 April 2017 (https://www.apachelounge.com/download/)
  • PHP 7.2.2 Win32 VC15 x86 NTS 31 January 2018 (http://windows.php.net/download#php-7.2)
  • VC_redist.x86.exe VC15 2017 14.12.25810


Running on :

  • Windows 8.1 Pro
  • Intel Core i7
  • 8 Gb RAM (5Go of free memory while execution)
  • Enough space on hard drive (SDD and HDD)
  • (Even tried on an other computer with similar config)



I tried with real files but it's easy to generate fake file with this Windows command :
Code:
fsutil file createnew test1GB.txt 1073741824 (For a 1GB file)
fsutil file createnew test950MB.txt 1000000000 (For a 950MB file)


I use this simple HTML form :

Code:
<form method="post" enctype="multipart/form-data" action="http://localhost/upload.php" >
  Uploads : <input type="file" name="uploads[]">
  <input type="submit">
</form>


PHP Script is also simple (upload.php):
Code:
<?php
foreach($_FILES as $file){
   
  if($file["error"][0] == 0){
     $tmp_name = $file["tmp_name"][0];
     $name = $file["name"][0];
    
     move_uploaded_file($tmp_name, "D:/uploadedfilesnre/$name");
    
     echo "tmp: " . $tmp_name ."nme: " . $name; //Displayed when upload works
  }else{
   echo "erreur"; //it never occurs ! Apache died before
  }
 
}



httpd.conf (Only show differences based on httpd.conf provided by Apache Lounge)
Code:
Timeout 1200
Include conf/extra/httpd-mpm.conf
Options FollowSymLinks

LoadModule fcgid_module modules/mod_fcgid.so
#In httpd-mpm.conf by default : ThreadsPerChild        150 AND MaxConnectionsPerChild   0


<IfModule fcgid_module>

  FcgidInitialEnv PATH "c:/php;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
  FcgidInitialEnv SystemRoot "C:/Windows"
  FcgidInitialEnv SystemDrive "C:"
  FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
  FcgidInitialEnv TMP "C:/WINDOWS/Temp"
  FcgidInitialEnv windir "C:/WINDOWS"
  FcgidIOTimeout 120
  FcgidConnectTimeout 16
  FcgidMaxRequestsPerProcess 1000
  FcgidMaxProcesses 150
  #FcgidMaxRequestLen 8131072 (to low)
  FcgidMaxRequestLen 2147483648

  #Html form stay waiting if following is disabled
  FcgidMaxRequestInMem 2147483648

  # Location php.ini:
  FcgidInitialEnv PHPRC "c:/php"
  FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

  #Also tried this whitout success
  ##FcgidBusyTimeout 300
  ##FcgidIOTimeout 300
  ##FcgidOutputBufferSize 2147483648
  ##FcgidIdleTimeout 0

  <Files ~ "\.php$>"
    Options Indexes FollowSymLinks ExecCGI
    AddHandler fcgid-script .php
    FcgidWrapper "c:/php/php-cgi.exe" .php
  </Files>

</IfModule>



php.ini (Only show differences based on php.ini-production provided by PHP)

Code:
max_execution_time = 300
max_input_time = 120
memory_limit = 2048M
post_max_size = 2048M
upload_max_filesize = 2048M
max_file_uploads = 20
file_uploads = On

error_reporting = E_ALL
display_errors = On
error_log = php_errors.log (Log file remains empty in this context, Apache dies before PHP)
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Fri 02 Mar '18 16:58    Post subject: Reply with quote

maybe you could try playing with ReceiveBufferSize and see if it helps any.
Back to top
Solune - NRE



Joined: 01 Mar 2018
Posts: 3
Location: France

PostPosted: Fri 02 Mar '18 17:56    Post subject: Reply with quote

Thank you for your reply but it doesn't change anything.

I also tried to play with MaxMemFree and ThreadStackSize.

Apache is still restarting while uploading :

Code:
Parent: child process 884 exited with status 3221225477 -- Restarting.


Chrome browser try to send the file a second time.
Another browser fails at the first attempt.
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 3049
Location: Hilversum, NL, EU

PostPosted: Sun 04 Mar '18 16:52    Post subject: Reply with quote

Anything in the Windows Event viewer during the crash. Special in which module it crashes.
Back to top
Solune - NRE



Joined: 01 Mar 2018
Posts: 3
Location: France

PostPosted: Mon 05 Mar '18 12:15    Post subject: Reply with quote

The faulting module is libaprutil-1.dll,

Code:
Nom de l’application défaillante httpd.exe, version : 2.4.29.0, horodatage : 0x59fc34e9
Nom du module défaillant : libaprutil-1.dll, version : 1.6.1.0, horodatage : 0x59fc372f
Code d’exception : 0xc0000005
Décalage d’erreur : 0x00002229
ID du processus défaillant : 0x278c
Heure de début de l’application défaillante : 0x01d3b45f5f98badc
Chemin d’accès de l’application défaillante : C:\Apache24\bin\httpd.exe
Chemin d’accès du module défaillant: C:\Apache24\bin\libaprutil-1.dll
ID de rapport : a095413b-2052-11e8-82fb-f2b5c9f9ceed
Nom complet du package défaillant :
ID de l’application relative au package défaillant :


This topic https://www.apachelounge.com/viewtopic.php?p=23833 leads me to turn EnableMMAP and EnableSendfile off.
It does not change anything.

As seen in this topic http://forum.wampserver.com/read.php?2,134915
Quote:
"If you have a 64-bit Windows, you must install both 32 and 64bit versions, even if you do not use Wampserver 64 bit"

I tried install VC15 64bits (32 bits already installed).
Do both bitness versions need to be installed? (Windows 64b | Apache & FCGI & PHP 32b)
Upload 1GB worked once ! ... a second upload crashed with error in ucrtbase.DLL (never reproduced this error after)

Rebooting Apache once again :
950 MB works every times
1 GB works sometimes
1,150GB works nether. Windows Event indicates libaprutil-1.dll fault as mentionned above each times.
Back to top


Reply to topic   Topic: Crash while uploading large file Apache 2.4 FCGI PHP7 View previous topic :: View next topic
Post new topic   Forum Index -> Apache