Le 18.08.2012 11:56, Alex Bligh a écrit : 

> --On 18 August 2012
11:35:29 +0200 Denis BUCHER 
> wrote:
> 
>> OK, but my problem is that
when I detect an "offending" process (using too much memory), it's
already too late ! The strace will only show mmaps until "[crit] Memory
allocation failed" ! Do you have a suggestion on how I could "intercept"
these processes before the problem happens ?
> 
> rlimit maybe.
> 
> I'd
suggest something is trying to allocate a 'negative' amount of memory.
>
The real answer is to locate the bug. If you really want to do that,
>
build/install debug versions of your s/w, attach gdb to the running
>
process, and ask for a backtrace.

And I think I was able to capture the
strace : 

> accept(4, {sa_family=AF_INET6, sin6_port=htons(42635),
inet_pton(AF_INET6, "::ffff:66.249.66.5", &sin6_addr), sin6_flowinfo=0,
sin6_scope_id=0}, [68719476764]) = 18
> semop(7438351, 0x2b91b7f24da6,
1) = 0
> getsockname(18, {sa_family=AF_INET6, sin6_port=htons(80),
inet_pton(AF_INET6, "::ffff:213.162.5.179", &sin6_addr),
sin6_flowinfo=0, sin6_scope_id=0}, [68719476764]) = 0
> fcntl(18,
F_GETFL) = 0x2 (flags O_RDWR)
> fcntl(18, F_SETFL, O_RDWR|O_NONBLOCK) =
0
> read(18, "GET /search/Delight%20combinaiso"..., 8000) = 280
>
stat("/var/www/vhosts/ourserver.ch/www/http/search/Delight
combinaison/metas-12-00088/1/de", 0x7fff2c6fe8c0) = -1 ENOENT (No such
file or directory)
> lstat("/var", {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0
> lstat("/var/www", {st_mode=S_IFDIR|0755, st_size=4096, ...})
= 0
> lstat("/var/www/vhosts", {st_mode=S_IFDIR|0755, st_size=4096,
...}) = 0
> lstat("/var/www/vhosts/ourserver.ch",
{st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, ...}) = 0
>
lstat("/var/www/vhosts/ourserver.ch/www", {st_mode=S_IFDIR|S_ISGID|0755,
st_size=4096, ...}) = 0
> lstat("/var/www/vhosts/ourserver.ch/www/http",
{st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
>
open("/var/www/vhosts/ourserver.ch/www/http/.htaccess", O_RDONLY) = 19
>
fstat(19, {st_mode=S_IFREG|0440, st_size=7995, ...}) = 0
> read(19,
"nn##############################"..., 4096) = 4096
> read(19,
"t_bw=$4&inc=$6&slang=$8 [P]nRewr"..., 4096) = 3899
> read(19, "", 4096)
= 0
> close(19) = 0
>
lstat("/var/www/vhosts/ourserver.ch/www/http/search", 0x7fff2c6fe8c0) =
-1 ENOENT (No such file or directory)
> ) = 0
> epoll_wait(17,
brk(0x2b91bbe3c000) = 0x2b91bbe16000 
> 
> Then, it only does mmap/brk
until "Cannot allocate memory"

  

Links:
------
[1]
mailto:dbuche...@hsolutions.ch

Reply via email to