Welcome! Log In Create A New Profile

Advanced

nginx tries to allocate a huge number of memory and fails

August 03, 2011 11:48PM
hi

i'm having a strange case where nginx is trying to allocate some
really huge amount of memory. we created a new vhost on nginx to
provide an internal interface to flush the apc cache of php. in most
of the cases i can request this and get what i expected, only in
around 20% of the request nginx is trying to allocate a huge number of
memory and fails, so it returns 500 internal server error.

2011/08/04 05:14:00 [emerg] 41529#0: *89012062 malloc()
18446744073709545066 bytes failed (12: Cannot allocate memory),
client: 192.168.1.195, server: *.kaufmich.vpn, request: "GET
/web1/apc/flushApc.php HTTP/1.1", host: "static.kaufmich.vpn"



does anybody have an idea why that would happen? i thought this almost
has to be a bug because the amount of bytes it is trying to allocate
is just so huge it just cant be right.



# nginx -V
nginx version: nginx/0.7.65
built by gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
configure arguments: --prefix=/usr/local/nginx-0.7.65
--without-http_ssi_module --without-http_userid_module
--without-http_geo_module --with-pcre=/tmp/pcre-8.02
--add-module=src/http/modules/ngx_cache_purge/

server {
server_name *.kaufmich.vpn;

access_log /var/log/nginx/deployment_interface/access.log;
error_log /var/log/nginx/deployment_interface/error.log debug;

set $doc_dir /var/www/kaufmich;
set $script_dir $doc_dir;
root $doc_dir;

location / {

if ($request_uri !~* /.+/.+/.+) {
return 501;
}

if ($request_uri ~* /(.+)/(.+\.php)) {
set $prod_server $1;
set $action $2;
set $script $3;
set $parameters "";
set $script_dir $doc_dir/$action;
}


if ($request_uri ~* /(.+)/(.+)/(.+\.php)) {
set $prod_server $1;
set $action $2;
set $script $3;
set $parameters "";
set $script_dir $doc_dir/$action;
}

if ($request_uri ~* /(.+)/(.+)/(.+\.php)\?(.+)) {
set $prod_server $1;
set $action $2;
set $script $3;
set $parameters $4;
set $script_dir $doc_dir/$action;
}

include fastcgi_params;
fastcgi_connect_timeout 3;
fastcgi_send_timeout 25;
fastcgi_read_timeout 25;
fastcgi_intercept_errors on;
fastcgi_param DOCUMENT_ROOT $script_dir;
fastcgi_param SCRIPT_NAME $script;
fastcgi_param SCRIPT_FILENAME $script_dir/$script;
fastcgi_param PATH_INFO $parameters;
fastcgi_param QUERY_STRING $parameters;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param REMOTE_ADDR $remote_addr;

if ($prod_server = "web1") {
fastcgi_pass web1.kaufmich.com.cgi;
break;
}
if ($prod_server = "web2") {
fastcgi_pass web2.kaufmich.com.cgi;
break;
}
if ($prod_server = "web3") {
fastcgi_pass web3.kaufmich.com.cgi;
break;
}

# else

return 501;

}
}

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx tries to allocate a huge number of memory and fails

replay August 03, 2011 11:48PM

Re: nginx tries to allocate a huge number of memory and fails

Maxim Dounin August 04, 2011 02:30AM

Re: nginx tries to allocate a huge number of memory and fails

replay August 04, 2011 02:48AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready