Solved kernel: pid 50008 (nginx), uid 60, was killed: out of swap space

Hi Bro,
I meet following problem:
Code:
Jun 16 00:38:32 myhost kernel: swap_pager_getswapspace(9): failed
Jun 16 00:38:32 myhost kernel: swap_pager_getswapspace(16): failed
Jun 16 00:38:32 myhost kernel: swap_pager_getswapspace(9): failed
Jun 16 00:38:32 myhost kernel: swap_pager_getswapspace(3): failed
Jun 16 00:38:33 myhost last message repeated 38 times
Jun 16 00:38:33 myhost kernel: swap_pager_getswapspace(16): failed
Jun 16 00:38:33 myhost last message repeated 2 times
Jun 16 00:38:33 kernel: pid 50008 (nginx), uid 60, was killed: out of swap space

By monitoring i see my host still have much memory (6/8 GB RAM free, 1,9/2 GB swap free)
Question is: why nginx was killed because of out of swap space while RAM is free and still have swap space free as monitoring showed ?
Thanks for your help!
 
It may request more memory than was available. You need to find out what's been eating your memory because this doesn't happen normally.
 
You may right. Linux has option vm.swappiness to control percent to use swap or physical memory. Do you know similar option on FreeBSD?
Thank for your help!
 
iIs it true that, fFreeBSD always try to use swap before use main memory?
I read it here:
https://www.freebsd.org/doc/faq/misc.html
16.1. FreeBSD uses a lot of swap space even when the computer has free memory left. Why?

FreeBSD will proactively move entirely idle, unused pages of main memory into swap in order to make more main memory available for active use. This heavy use of swap is balanced by using the extra free memory for caching.

Note that while FreeBSD is proactive in this regard, it does not arbitrarily decide to swap pages when the system is truly idle. Thus, the system will not be all paged out after leaving it idle overnight.
But I am not sure iI fully understand.
 
is it true that, freeBSD always try to use swap before use main memory?
No, you didn't read it correctly. It will try to move idle memory to swap. That's memory that's reserved by some application but hasn't been touched in a while. This will get swapped out (it's not being used anyway) to make room for applications that do have memory actively in use.

In your case you simply ran out of memory so the OS started using swap. And even that ran out after a while. So you have a badly behaving application that keeps eating memory until there's nothing left.
 
Thank for your help. I installed atop with 1 minute interval. I can see our app requested huge number of memory. And then it call to swap. That why i see out of swap space in message log.
Thank you!
 
Back
Top