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: http2 VirtualAlloc() failed 2.4.18-dev [solved]
Author
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Sun 15 Nov '15 19:41    Post subject: http2 VirtualAlloc() failed 2.4.18-dev [solved] Reply with quote

http2 works fine, except the following case:
I use SFPG (Single File PHP Gallery 4.5.7) for a Photo gallery. SFPG creates thumbnail images for photos, and in case there are lots of photos on a single folder, let's say 50 or more, I get errors in Apache log, and SFPG does not create thumbnail images.

VirtualAlloc() failed: [0x000005af] Sivutustiedosto on liian pieni tämän toiminnon loppuun suorittamiseksi. (~Page file is too small to finish this action)
VirtualFree() failed: [0x000001e7] Yritettiin käyttää osoitetta, joka ei kelpaa. (~Attempt to use invalid address)

Several lines of both errors messages.

If I disable http2, there are no error messages and SFPG runs ok.

What is the actual cause of the memory related error messages with http2, as with http1 there are no errors?

I know there are some directives for http2 in Apache that control number of workers and stream memory size. Would they be any help in this case?

Apache 2.4.18-dev x64, Windows 10 Pro
Back to top
Steffen
Moderator


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

PostPosted: Sun 15 Nov '15 20:04    Post subject: Reply with quote

I am also dealing with memory issues, even it crashes.

Disabled mod_http2 for now, and all fine.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Mon 16 Nov '15 13:12    Post subject: Reply with quote

I have a mod_http2.so 1.4.0 with nghttp2 compiled statically into the module. As long as the nghttp2 API is not stable there is no sense in using a separate nghttp2.dll.

Chances are that the memory management is also different, so you might try it. The module is inside this zip:

https://phpdev.toolsforresearch.com/openssl-1.0.2d-fips-2.4.18-dev-x64-vc14.zip

BTW: today I ran into a Drupal6 'too many open files' error on Apache 2.4.17 VC9 with mod_php 5.3 and nghttp2 1.3.4. I do not know if the error was related to nghttp2.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Mon 16 Nov '15 17:38    Post subject: Reply with quote

I was not using a separate nghttp2.dll.

I used mod_http2.so in Apache 2.4.18-dev from Apache Lounge.

Tested also with Apache Lounge inside https://phpdev.toolsforresearch.com/openssl-1.0.2d-fips-2.4.18-dev-x64-vc14.zip, no difference.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Mon 16 Nov '15 17:56    Post subject: Reply with quote

The Apache Lounge 2.4.18-dev build needs the nghttp2.dll in Apache24\bin\, my version can do without bacause all the functions in nghttp2.dll are compiled directly into mod_http2.so.

Did you experience the same problems with Apache 2.4.17?
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Mon 16 Nov '15 18:09    Post subject: Reply with quote

@Steffen: VirtualAlloc() and VirtualFree() are only called from within PCRE\sljit. Could it be a collision between the JIT feature of PCRE and nghttp2?

Last edited by Jan-E on Mon 16 Nov '15 18:30; edited 2 times in total
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Mon 16 Nov '15 18:16    Post subject: Reply with quote

Jan-E wrote:
Did you experience the same problems with Apache 2.4.17?


I did not try http2 until 2.4.18-dev, so I have no experience with 2.4.17
Back to top
glsmith
Moderator


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

PostPosted: Mon 16 Nov '15 21:39    Post subject: Reply with quote

or, is this php5apache2_4.dll and not a large enough ThreadStackSize in Apache? PHP recommends this be set to 8388608 when running php as a module and using pcre_*() functions.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Mon 16 Nov '15 21:51    Post subject: Reply with quote

ThreadStackSize was not defined.
Set it to 8388608 and restarted server with http2 in use; same result, VirtualAlloc() errors in Apache log.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Tue 17 Nov '15 12:45    Post subject: Reply with quote

@Gregg: as far as I can see, the Apachehaus binaries for pcre.dll aren't compiled with JIT support (there is no string VirtualAlloc or VirtualFree in the dll). That might explain why Apachehaus.net (and my servers) do not experience this problem.

@Timo: here is a pcre.dll without JIT support:

https://phpdev.toolsforresearch.com/pcre_VC14_x64.zip

If you replace the pcre.dll in Apache24\bin with the one in the zip, you should not get the VirtualAlloc and VirtualFree errors anymore (because the routines aren't in the pcre.dll). Let us see if you get other errors now.

This is the configuration of the dll:
Code:
--   C compiler ...................... : C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
--   C++ compiler .................... : C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
--   C compiler flags ................ :  /DWIN32 /D_WINDOWS /W3
--   C++ compiler flags .............. :  /DWIN32 /D_WINDOWS /W3 /GR /EHsc
--
--   Build 8 bit PCRE library ........ : ON
--   Build 16 bit PCRE library ....... : ON
--   Build 32 bit PCRE library ....... : ON
--   Build C++ library ............... : ON
--   Enable JIT compiling support .... : OFF
--   Enable UTF support .............. : ON
--   Unicode properties .............. : ON
--   Newline char/sequence ........... : LF
--   \R matches only ANYCRLF ......... : OFF
--   EBCDIC coding ................... : OFF
--   EBCDIC coding with NL=0x25 ...... : OFF
--   Rebuild char tables ............. : ON
--   No stack recursion .............. : OFF
--   POSIX mem threshold ............. : 10
--   Internal link size .............. : 2
--   Parentheses nest limit .......... : 250
--   Match limit ..................... : 10000000
--   Match limit recursion ........... : MATCH_LIMIT
--   Build shared libs ............... : ON
--   Build static libs ............... : OFF
--   Build pcregrep .................. : ON
--   Enable JIT in pcregrep .......... : OFF
--   Buffer size for pcregrep ........ : 20480
--   Build tests (implies pcretest  .. : OFF
--                and pcregrep)
--   Link pcregrep with libz ......... : ON
--   Link pcregrep with libbz2 ....... : Library not found
--   Link pcretest with libeditline .. : Library not found
--   Link pcretest with libreadline .. : Library not found
--   Support Valgrind .................: OFF
--   Support coverage .................:
--   Install MSVC .pdb files ..........: ON
Back to top
Steffen
Moderator


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

PostPosted: Tue 17 Nov '15 13:51    Post subject: Reply with quote

@Timo do you run mod_security ?

I am not aware that http and mod_http2 does JIT calls. Mod-security from Apache Lounge does.

Maybe mod_http2 is consuming too much httpd memory so that mod_security is getting the trouble.

Here i run mod-http2 in an httpd instance with a minimal pcre.dll (without JIT) and it crashes after a while.

btw.
Stefan (author mod_http2) confirmed that mod_http2 is leaking memory.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Tue 17 Nov '15 16:45    Post subject: Reply with quote

I replaced pcre.dll as instructed. No change, VirtualAlloc() failed: [.....] is still written in Apache log.
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Tue 17 Nov '15 16:45    Post subject: Reply with quote

I do not use mod_security.
Back to top
Jan-E



Joined: 09 Mar 2012
Posts: 1266
Location: Amsterdam, NL, EU

PostPosted: Tue 17 Nov '15 19:15    Post subject: Reply with quote

Then it probably is not the pcre.dll. PHP also has some calls to VirtualAlloc, even in php5ts.dll it self. So it will be hard to avoid. Did you consider switching to PHP NTS, loaded by mod_fcgid.so?

The mod_fcgid.so is in the same zip as my mod_http2.so:
https://phpdev.toolsforresearch.com/openssl-1.0.2d-fips-2.4.18-dev-x64-vc14.zip
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Tue 17 Nov '15 19:30    Post subject: Reply with quote

Quote:
Did you consider switching to PHP NTS, loaded by mod_fcgid.so?

I have not considered and at least for now, I will not consider PHP NTS.
http2 is not that important for me right now, and as everything works ok with http1, I can do without http2 until some solution is discovered.
Back to top
Steffen
Moderator


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

PostPosted: Fri 20 Nov '15 14:43    Post subject: Reply with quote

@timo and others want to test.

New build with mod_http2 1.0.5, Stefan has addressed some memory issues. ApacheLounge running this build now.


Dowload, see https://www.apachelounge.com/viewtopic.php?p=32183


Last edited by Steffen on Fri 20 Nov '15 19:53; edited 2 times in total
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Fri 20 Nov '15 17:17    Post subject: Reply with quote

Steffen wrote:
@timo and others want to test.

http2 still produces
Code:
VirtualAlloc() failed
and
Code:
VirtualFree() failed

With SFPG (Single File PHP Gallery), if there are 70 or more thumbnails to be created, it always results in error.

http1 runs ok with no errors.
Back to top
icing



Joined: 22 Sep 2015
Posts: 41
Location: Münster, Germany

PostPosted: Fri 20 Nov '15 17:49    Post subject: Reply with quote

One problem that you experience in the image gallery might be that Apache, by default, is willing to accept up to 100 streams per connection.

So, a HTTP/2 browser will throw all 70 thumbnail requests in parallel at the server and they will, more or less, consume 70 times the memory that you would see over HTTP/1.

One way to test this is to reduce the number of concurrent streams with the H2MaxSessionStreams directive. Maybe you could try:

H2MaxSessionStreams 10

and see how that works in your setup.

//Stefan
Back to top
timo



Joined: 03 Jun 2012
Posts: 45
Location: FI, EU

PostPosted: Fri 20 Nov '15 18:24    Post subject: Reply with quote

Tested with H2MaxSessionStreams 10, and it seems that the problem is solved. I tested with 105 thumbnails in one folder without any errors.

Thanks, Stefan
Back to top


Reply to topic   Topic: http2 VirtualAlloc() failed 2.4.18-dev [solved] View previous topic :: View next topic
Post new topic   Forum Index -> Apache