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: Need guidance on error: BUF_MEM_grow:malloc failure
Author
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 04 Apr '11 18:02    Post subject: Need guidance on error: BUF_MEM_grow:malloc failure Reply with quote

We have 2 (tw0) apache 2.2.16 instances being load balanced by a Blue Coat Proxy SG and the web site (SSL-enabled) have recently been going down and unavailable to users. We noticed that the memory utilization for httpd.exe is ever increasing up to over 1.3Gb in size. This is on a windows 2003 R2 server with PHP 5.2.17, Apache 2.2.16 (from ASF) with PHP being used as Apache module and with Oracle 10g as backend RDBS.

There are the errors we are getting:


[info] SSL Library Error: 336183361 error:1409C041:SSL routines:SSL3_SETUP_BUFFERS:malloc failure

[info] SSL Library Error: 117850177 error:07064041:memory buffer routines:BUF_MEM_grow:malloc failure

Has anyone encountered such errors before? Hope you can point us to the right direction to fix this.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 04 Apr '11 20:27    Post subject: Reply with quote

Which SSL caching do you use?
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 04 Apr '11 20:56    Post subject: Reply with quote

Hi James,

Thanks much for the quick response.

Here's what's from ssl.conf.

SSLSessionCache dbm:logs/ssl_scache
SSLSessionCacheTimeout 300

Is this what you were referring to?

Please advise

Thanks again

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 08 Apr '11 16:07    Post subject: Reply with quote

There is at least an issue with the sessions save handler.
In 2.2.17 there was a mod_ssl fix. (I recommend to use a VC9 compiled apache like from this page.)
Quote:

*) mod_ssl: Do not do overlapping memcpy. PR 45444 [Joe Orton]


Quote:

We noticed that the memory utilization for httpd.exe is ever increasing up to over 1.3Gb in size.


Often PHP blows up apaches memory. I and many others made good experience with mod_fcgid. After the separation of apache and PHP I never had that memory increasing of apache.
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 11 Apr '11 16:50    Post subject: Reply with quote

Thanks James,

Will go ahead and make preparations for that.

Also, i know this if off-topic, so my apologies, but I figured you would already have a handle on this. On PHP.net, it says that PHP 5.3.6 will only work with Apache 2.2.17 from apachelounge. What is your take on that? other than us having to compile the source in-house?

If you do recommend or use that combination, what are the pre-requisites?

Thaniks again so much

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 11 Apr '11 20:40    Post subject: Reply with quote

Yeah,
using PHP over fcgid makes it much more stable than the module. For me I haven't found any disadvantages. But some ppl think that php over fcgid is a bit slower than the module.
I compile apache and php myself cause I want to have 64 bit version Wink I used apachelounge binaries long time without issues.
The main reason why php.net says using apache from here it cause php guys (Pierre) don't compile php with VC6 anymore. Now they using VC9. Since apache.org (ASF guys) still using VC6 and at this point don't offer VC9 build you can't run 5.3.6 PHP with apacge from apache.org. Not fully true. With fcgid it would work, but not with the module which is is most commen installation on windows so far.
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 11 Apr '11 21:15    Post subject: Reply with quote

Hi James,

Thanks for the info. Great help. Will now see what the best route to go would be for us here.

Thanks again. Will keep you posted of any results.

Joby
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Fri 22 Apr '11 17:12    Post subject: Reply with quote

Hi James, I was able to get a successful install of PHP 5.3.6 (php.net) and Apache 2.2.17 (apachelounge) with php as apache module. Am still getting memory utilization increasing over time.

Can you point me to the right direction on how i can use mod_fcgid?

thanks so much.

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Fri 22 Apr '11 18:07    Post subject: Reply with quote

There is a small how to http://www.apachelounge.com/viewtopic.php?t=3430
and http://fuzzytolerance.info/code/apache-mod_fcgid-and-php-on-windows/
if you still have a question please ask again
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Fri 22 Apr '11 21:56    Post subject: Reply with quote

James, thanks so much. The links were very helpful.

I got it configured and phpinfo() works with oci8 extensions.

The last hurdle now is that some of the php code is embedded in html files. Would you know of a workaround for this using fcgid?

Thanks again so much James

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Sat 23 Apr '11 11:43    Post subject: Reply with quote

dereference wrote:

The last hurdle now is that some of the php code is embedded in html files. Would you know of a workaround for this using fcgid?


?? Doesn't have the file the .php extension? What's the issue? I don't get it. Short tag issue?
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 25 Apr '11 3:01    Post subject: Reply with quote

Hi James,

Yes, some php code being called in .html files not loading. i have short_tags set to on.

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Mon 25 Apr '11 19:20    Post subject: Reply with quote

You can add a second wrapper for parsing .html extensions with php,too.


Something like:
Code:

   FcgidWrapper "c:/php/php-cgi.exe" .php
   FcgidWrapper "c:/php/php-cgi.exe" .html


edit: forgot something
Code:

   AddHandler fcgid-script .php .html
   FcgidWrapper "c:/php/php-cgi.exe" .php
   FcgidWrapper "c:/php/php-cgi.exe" .html
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Mon 25 Apr '11 23:41    Post subject: Reply with quote

Hi James,

Thanks. The directives you showed me worked in html pages with embedded php calls using mod_fcgid.

Just one more thing though, I think this is probably an environment setting issue, but when I implemented this, the oci8 pconnect() wont work enymore, even though phpinfo() page shows the OCI8 section as being there under mod_fcgid.

Would you have any thoughts on this? The server PATH is set to the oracle instant client and oci8 pconnect() does work with PHP as an apache module. Or is there a known oci8 workaround when using it with fast CGI?


Once again, thanks for all your help.

Best regards,

joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 26 Apr '11 11:56    Post subject: Reply with quote

It can work, if the PHP process lives long enough. it will bwe reused even with fast cgi

from the manual http://www.php.net/manual/en/function.oci-pconnect.php
Quote:

Persistent connections are cached and re-used between requests, resulting in reduced overhead on each page load; a typical PHP application will have a single persistent connection open against an Oracle server per Apache child process (or PHP FastCGI/CGI process). See the Persistent Database Connections section for more information.


Does it work with oci_connect instead of oci_pconnect?? Which error message do you get?
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Tue 26 Apr '11 22:36    Post subject: Reply with quote

Hi James,

Thanks for the info. The oci_pconnect() works with php as apache module and when I implemented mod_fcgid, it failed with these errors. oci_pconnect also worked with php as apache module.

here is what's showing in the php error log:

PHP Warning: oci_connect(): ORA-12154: TNS:could not resolve the connect identifier specified in connect.php on line 47

Seems like i'm missing an environment variable setting to point to the tnsames.ora file in the oracle instant client directory.

The instant client directory is included in the system $PATH,with PHP path first, followed by the oracle instant client directory. This setting worked with php as apache module but somehow with mod_fcgi, it could not recognize the connect string.

The directives I added in httpd.conf server-wide with ExecCGI added as Options in the directory container for DocumentRoot.

I did not place any fcgid diectives in the directory container nor in the virtual hosts section which is SSL-enabled (ssl.conf). The whole site can only be accessed via HTTPS.

This is what's in the bottom of the httpd.conf file:

LoadModule fcgid_module modules/mod_fcgid.so


<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi .php .html

# where to look for the php.ini file
FcgidInitialEnv PHPRC "F:/PHP2"

# SET PHP_FCGI_MAX_REQUESTS to greater than or equal to FcgidMaxRequestsPerProcess

FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000

# Maximumnumber of PHP Processes
FcgidMaxProcesses 15

# Number of seconds of idle tie before a php-cgi process is terminated
FcgidIOTimeout 120
FcgidIdleTimeout 120

#path to php-cgi
FcgidWrapper "f:/php2/php-cgi.exe" .php
FcgidWrapper "f:/php2/php-cgi.exe" .html

Addtype applications/x-httpd-php .php
AddType application/x-httpd-php .html
</IfModule>

I used PHP 5.3.6 msi NTS x32 from php.net and our server is windows 2003 R2.

Thanks again so much

Joby
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 03 May '11 10:11    Post subject: Reply with quote

Sorry for the late reply. I didn't see your answer. For that issue see http://ora-12154.ora-code.com/

Sometimes I had the issue that over fcgid I wasn't able to use DNS in MySQL. So instead of localhost I had to use 127.0.0.1 Maybe this applies here also.
Back to top
dereference



Joined: 04 Apr 2011
Posts: 12

PostPosted: Fri 13 May '11 14:16    Post subject: Reply with quote

Hi James,

Thanks for the info. Sorry, late reply too. Am checking out the link now

Joby
Back to top


Reply to topic   Topic: Need guidance on error: BUF_MEM_grow:malloc failure View previous topic :: View next topic
Post new topic   Forum Index -> Apache