Possible memory leak?

wkbrad nginx-forum at forum.nginx.org
Thu Mar 21 21:55:23 UTC 2019


Hey Maxim,

Thanks again!  I was a little confused at first because your tests in
freebsd were so much different than mine but then I found what you did
wrong.

You were testing the 2nd reload but the issue can only be seen on the first
reload.  Here is my test to show what I mean.
--------------------------------------------------------------------------------
root at freebsd:~ # service nginx restart; sleep 10; ps aux | grep -v grep |
grep nginx ; top | grep Mem
root  864   0.0  5.4 121796 110344  -  Ss   10:02   0:00.00 nginx: master
process /usr/local/s
www   865   0.0  5.4 121796 110348  -  S    10:02   0:00.00 nginx: worker
process (nginx)
Mem: 116M Active, 2808K Inact, 87M Wired, 42M Buf, 1750M Free

root at freebsd:~ # service nginx reload ; sleep 10 ; ps aux | grep -v grep |
grep nginx ; top | grep Mem
root  864   0.0 10.2 219844 209392  -  Ss   10:02   0:00.45 nginx: master
process /usr/local/s
www   881   0.0 10.2 219844 209388  -  S    10:03   0:00.01 nginx: worker
process (nginx)
Mem: 213M Active, 7652K Inact, 88M Wired, 42M Buf, 1646M Free

root at freebsd:~ # service nginx reload ; sleep 10 ; ps aux | grep -v grep |
grep nginx ; top | grep Mem
root  864   0.0 11.4 242920 234400  -  Ss   10:02    0:00.91 nginx: master
process /usr/local/
www   898   0.0 11.4 242920 234400  -  S    10:07    0:00.01 nginx: worker
process (nginx)
Mem: 239M Active, 82M Inact, 89M Wired, 42M Buf, 1546M Free
--------------------------------------------------------------------------------

Notice that my 2nd reload looks just like your test. But compare the restart
test to the 1st reload and you'll see what I mean.  Active ram doubles, it's
not in inactive, and the free ram also went down by the same amount that
active ram increased.

I bet if you run that same test on your server you'll see the same thing
that I do.  Can you run that test and send me the results?  I'm sure you
know this but make sure that the reload is complete before you check the ram
usage or you'll get misleading results.  :)

Thanks!

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,283216,283469#msg-283469



More information about the nginx mailing list