Documentation

Documentation.TroubleShooting-OutOfMem History

Hide minor edits - Show changes to markup

March 16, 2021, at 10:12 AM by liviu -
Changed line 33 from:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify the OPTIONS="-a Q_MALLOC_DBG" command-line option for the opensips binary. Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
to:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify the OPTIONS="-a Q_MALLOC_DBG" command-line option for the opensips binary. You only have to restart OpenSIPS now, not yet though! (see below)
July 27, 2020, at 09:56 AM by 2.87.209.72 -
Changed line 29 from:

1.

to:

1. Enable memory debugging

June 03, 2019, at 10:19 PM by liviu -
Changed line 33 from:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
to:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify the OPTIONS="-a Q_MALLOC_DBG" command-line option for the opensips binary. Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
June 03, 2019, at 10:19 PM by liviu -
Changed line 33 from:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
to:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
June 03, 2019, at 10:19 PM by liviu -
Changed line 33 from:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the memory leak debugging allocator!
to:
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the newly chosen memory leak debugging allocator!
June 03, 2019, at 10:18 PM by liviu -
Changed lines 19-22 from:

TEST: wait ~ 20 minutes without any kind of load the proxy. Test the proxy by placing several calls; if the memory errors pop up again once the traffic is resumed, it means it's a memory leak somewhere; If not sure of the result, consider it's a memory leak.

to:

TEST: wait ~5 minutes without any kind of load the proxy, so the majority of calls get a chance to close. Test the proxy by placing several calls; if the memory errors pop up again once the traffic is resumed, it means it's a memory leak somewhere; If not sure of the result, consider it's a memory leak.

Changed lines 27-28 from:

If it is about a memory leak or a memory corruption issue, you need to compile the debug support into memory manager. To do so, follow the next steps:

to:

If it is about a memory leak or a memory corruption issue, you need to compile or enable the debug support into the memory manager. To do so, follow the next steps:

Changed lines 30-35 from:
  • OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • OpenSIPS 1.8 - 2.1 : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.

2. recompile everything

to:
  • OpenSIPS 1.7 and below (recompile required): edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • OpenSIPS 1.8 - 2.1 (recompile required): Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 2.2 - 2.4 (recompile required): Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 3.0 and above: edit /etc/default/opensips (on Debian) or /etc/sysconfig/opensips (on Red Hat), and specify OPTIONS="-a Q_MALLOC_DBG" . Next, restart OpenSIPS in order to run with the memory leak debugging allocator!

2. OpenSIPS 2.4 and below: recompile everything

Changed lines 57-61 from:

2. At run time - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSIPS_PID") - it will dump the SHM and PKG (only for that process) memory status. It is highly recommended to do this after waiting about 20 minutes to be sure that as much as possile memory is freed - all temporary memory used during processing is freed by lack of load on the proxy. Go through the log and see if there is something suspicious, like too much memory still allocated from same place, etc...

to:

2. At run time

  • OpenSIPS 2.4 and below - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSIPS_PID") - it will dump the PKG (only for that process) memory status. To obtain the status of the SHM pool, pick the attendant process PID (run "opensipsctl fifo ps" and pick 1st PID). It is highly recommended to do this after waiting about 20 minutes to be sure that as much as possible memory is freed - all temporary memory used during processing is freed by lack of load on the proxy. Go through the log and see if there is something suspicious, like too much memory still allocated from same place, etc...
  • OpenSIPS 3.0 and above - the memory status can be checked using the opensips-cli -x mi mem_pkg_dump <pid> and opensips-cli -x mi mem_shm_dump MI commands. Same general recommendations as above.
October 11, 2017, at 11:30 AM by liviu -
Changed line 13 from:

b) memory leak - some memory id not properly freed, making all the memory unavailable (not used, but still allocated)

to:

b) memory leak - some memory ids are not properly freed, so they will gradually fill up all available memory (not used, but still allocated)

June 13, 2016, at 06:21 PM by liviu -
Changed line 42 from:

1. **At shutdown** - just stop the proxy - the memory manager will dump the memory status. Normally most of the memory is cleaned during shutdown. If there is memory leak, it should be visible as not-freed memory. A memory status looks like:

to:

1. At shutdown - just stop the proxy - the memory manager will dump the memory status. Normally most of the memory is cleaned during shutdown. If there is a memory leak, it should be visible as not-freed memory. A memory status looks like:

Changed line 56 from:

2. **At run time** - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSIPS_PID") - it will dump the SHM and PKG (only for that process) memory status. It is highly recommended to do this after waiting about 20 minutes to be sure that as much as possile memory is freed - all temporary memory used during processing is freed by lack of load on the proxy. Go through the log and see if there is something suspicious, like too much memory still allocated from same place, etc...

to:

2. At run time - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSIPS_PID") - it will dump the SHM and PKG (only for that process) memory status. It is highly recommended to do this after waiting about 20 minutes to be sure that as much as possile memory is freed - all temporary memory used during processing is freed by lack of load on the proxy. Go through the log and see if there is something suspicious, like too much memory still allocated from same place, etc...

June 13, 2016, at 06:21 PM by liviu -
Changed line 36 from:

3. set memlog=1 in your configuration script (to get the memory messages) - it must be lower than debug.

to:

3. set memdump = 1 in your configuration script (to get the memory messages) - it must be lower than debug.

March 29, 2016, at 02:30 PM by liviu -
Changed lines 30-32 from:
  • OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • OpenSIPS 1.8 - 2.1 : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
to:
  • OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • OpenSIPS 1.8 - 2.1 : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
March 29, 2016, at 02:30 PM by liviu -
Changed line 32 from:
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
to:
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
March 29, 2016, at 02:30 PM by liviu -
Changed lines 30-31 from:
  • If Using OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
to:
  • OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • OpenSIPS 1.8 - 2.1 : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
  • OpenSIPS 2.2 and above : Run 'make menuconfig' from the main source dir -> Configure Compile Options -> Configure Compile Flags -> check QM_MALLOC and DBG_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
September 09, 2014, at 03:47 PM by liviu -
Changed line 31 from:
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check the DBG_QM_MALLOC option. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
to:
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check DBG_QM_MALLOC. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
September 09, 2014, at 03:47 PM by liviu -
Changed line 31 from:
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check the DBG_QM_MALLOC option. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
to:
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check the DBG_QM_MALLOC option. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.
September 09, 2014, at 03:46 PM by liviu -
Changed line 25 from:

If the memory pool is too small, you can increase the available pools with the -m (shared mem) and -M (per process mem) parameters of the opensips binary (values are given in MB).

to:

If the memory pool is too small, you can increase the available pools with the -m (shared mem) and -M (per process mem) parameters of the opensips binary (values are given in MB).

September 09, 2014, at 03:45 PM by liviu -
Changed line 25 from:

If the memory pool is too small, you can increase the available pools with the -m (shared mem) and -M (per process mem) parameters of the opensips binary (in MB).

to:

If the memory pool is too small, you can increase the available pools with the -m (shared mem) and -M (per process mem) parameters of the opensips binary (values are given in MB).

September 09, 2014, at 03:45 PM by liviu -
Changed line 25 from:

If the memory pool is too small, just go in config.h and increase the size of the memory pool - for SHM or PKG.

to:

If the memory pool is too small, you can increase the available pools with the -m (shared mem) and -M (per process mem) parameters of the opensips binary (in MB).

October 30, 2013, at 10:19 AM by 109.99.235.212 -
Changed line 1 from:

Documentation -> TroubleShooting -> Out Of Memory

to:

Documentation -> TroubleShooting -> Out Of Memory

May 09, 2013, at 02:53 PM by 79.118.227.150 -
Changed line 1 from:
to:

Documentation -> TroubleShooting -> Out Of Memory

May 09, 2013, at 02:48 PM by 79.118.227.150 -
Changed lines 1-2 from:

Resources -> Documentation -> Out Of Memory

to:
April 24, 2013, at 07:33 PM by 213.233.101.41 -
Added lines 1-57:

Resources -> Documentation -> Out Of Memory

What to do if "out of memory" or "no more memory" messages are generated by OpenSIPS?

Potential causes

There are two cause that may lead to memory starvation:

a) a small pool of memory - the configured memory is not enough and no more memory can be allocated.

b) memory leak - some memory id not properly freed, making all the memory unavailable (not used, but still allocated)

Determining the cause

If the memory starvation is because of a too small pool of memory, by stopping the traffic on the proxy (without stopping the proxy), the allocated memory will be freed in time (as transactions and location records are freed). TEST: wait ~ 20 minutes without any kind of load the proxy. Test the proxy by placing several calls; if the memory errors pop up again once the traffic is resumed, it means it's a memory leak somewhere; If not sure of the result, consider it's a memory leak.

How to handle it

If the memory pool is too small, just go in config.h and increase the size of the memory pool - for SHM or PKG.

If it is about a memory leak or a memory corruption issue, you need to compile the debug support into memory manager. To do so, follow the next steps:

1.

  • If Using OpenSIPS 1.7 and below : edit Makefile.defs file and remove from the DEFS string the F_MALLOC define (delete "-DF_MALLOC" line) and add the DBG_QM_MALLOC define (insert a "-DDBG_QM_MALLOC" line).
  • If Using OpenSIPS 1.8 and above : Run 'make menuconfig' from the main sources folder, go to 'Configure Compile Options', then to 'Configure Compile Flags', use the arrow keys to go down and uncheck F_MALLOC via the spacebar key, and check the DBG_QM_MALLOC option. Then hit 'q' to go back to the previous menu, and hit 'Save Changes'.

2. recompile everything

3. set memlog=1 in your configuration script (to get the memory messages) - it must be lower than debug.

4. restart your proxy

Now, you may check the memory status in two situations:

1. **At shutdown** - just stop the proxy - the memory manager will dump the memory status. Normally most of the memory is cleaned during shutdown. If there is memory leak, it should be visible as not-freed memory. A memory status looks like:

     0(17665) Memory status (shm):
     0(17665) qm_status (0xb5a7e000):
     0(17665)  heap size= 33554432
     0(17665)  used= 1592952, used+overhead=1811564, free=31742868
     0(17665)  max used (+overhead)= 1811564
     0(17665) dumping all alloc'ed. fragments:
     0(17665)       0. N  address=0xb5ab240c frag=0xb5ab23f4 size=4 used=1
     0(17665)             alloc'd from mem/shm_mem.c: shm_mem_init_mallocs(199)
     0(17665)         start check=f0f0f0f0, end check= c0c0c0c0, abcdefed
     0(17665)       1. N  address=0xb5ab2440 frag=0xb5ab2428 size=4 used=1 
     0(17665)             alloc'd from timer.c: init_timer(52)
     0(17665)         start check=f0f0f0f0, end check= c0c0c0c0, abcdefed

2. **At run time** - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSIPS_PID") - it will dump the SHM and PKG (only for that process) memory status. It is highly recommended to do this after waiting about 20 minutes to be sure that as much as possile memory is freed - all temporary memory used during processing is freed by lack of load on the proxy. Go through the log and see if there is something suspicious, like too much memory still allocated from same place, etc...

If you have no clue how to interpret the logs for memory status, post it on a FTP or HTTP server and send the link on the devel@lists.opensips.org mailing list.


Page last modified on March 16, 2021, at 10:12 AM