Resources.DocsTsMem History

Hide minor edits - Show changes to markup

April 24, 2013, at 06:33 PM by 213.233.101.41 -
Changed lines 1-57 from:

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.

to:

(:redirect Documentation.TroubleShooting-OutOfMem quiet=1 :)

October 22, 2012, at 01:22 PM by bogdan -
Changed lines 57-67 from:

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.

(:nl:)>>messagehead<<

Torbara?22 October 2012, 03:25

Grazi for manikg it nice and EZ.

(:commentboxchrono:)

to:

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.

October 22, 2012, at 01:18 PM by bogdan -
Deleted lines 64-69:

(:nl:)>>messagehead<<

Amit?22 October 2012, 12:29

By any standards we are being ruled by a group of men who have in nomral standards Failed to Make it Most of School drop outs who are ineffectual takes to the profession of constables and become Inspectors or SPs.Most of those guys who reach graduation and ineffectual takes the law degree and they become Hon'ble Judges .Some ineffectual become Govt officialsMost of those ineffectual guys who don't make any become MPs and MLAs and become law makers.Clever among the rest of ineffectuals become traders and businessmen.The Law makers are CRIME HungryThey criminalize most of civil wrong and prescribe jail.eg. NI 138- Cheque bouncing is jailable.Non filing of IT returns is jailable.Non return of debt is jailable.Demanding Dowry is jailable.Any conduct by likely to cause danger to mental health (I repeat) likely to cause danger to mental health of wife is jailable.Delayed payment of statutory dues is jailable. and the list is endless better read IPC.The police is Arrest HungryThey first arrest you and then start investigating allegations of offence.They have discretionary powers to arrest just by filing an FIR.The Judges are Jail Hungry.For them freedom has no meaning.The mete out punishment on allegations by refusing bail.They think giving bail to an accused is great favor.They happily adjourn bail matters for days and months and either enjoy pleasure or extort favour or moneyOnly the businessman or trader enjoy the fruits of the system.They treat their employees as slaves make huge money and they have perfected the art of Bribing and manipulate the society!!Intellectuals, common man, critics etc who undergo the torture are silent spectators.It is the poor man who has nothing more to loose take up law into hands and he either become a Goonda or a Maoist!!In Afghan there is a statutory Govt. andTalibans are illegal outfits.In India we have legal elected Taliban Governance!WE CALL IT DEMOCRACY!!!So encounters, Custodial killings and police or Govt induced murders are simply social service.In TN out of 1542 murders in 2009 543 murders reletes to adultery by women!!When the Courts take 15 years to grant Divorce is it is not nomral for husbands whose wife is adulterous before his eyes to take the law in his own hands?

October 22, 2012, at 12:29 PM by Amit - Comment added
Added lines 65-70:

(:nl:)>>messagehead<<

Amit?22 October 2012, 12:29

By any standards we are being ruled by a group of men who have in nomral standards Failed to Make it Most of School drop outs who are ineffectual takes to the profession of constables and become Inspectors or SPs.Most of those guys who reach graduation and ineffectual takes the law degree and they become Hon'ble Judges .Some ineffectual become Govt officialsMost of those ineffectual guys who don't make any become MPs and MLAs and become law makers.Clever among the rest of ineffectuals become traders and businessmen.The Law makers are CRIME HungryThey criminalize most of civil wrong and prescribe jail.eg. NI 138- Cheque bouncing is jailable.Non filing of IT returns is jailable.Non return of debt is jailable.Demanding Dowry is jailable.Any conduct by likely to cause danger to mental health (I repeat) likely to cause danger to mental health of wife is jailable.Delayed payment of statutory dues is jailable. and the list is endless better read IPC.The police is Arrest HungryThey first arrest you and then start investigating allegations of offence.They have discretionary powers to arrest just by filing an FIR.The Judges are Jail Hungry.For them freedom has no meaning.The mete out punishment on allegations by refusing bail.They think giving bail to an accused is great favor.They happily adjourn bail matters for days and months and either enjoy pleasure or extort favour or moneyOnly the businessman or trader enjoy the fruits of the system.They treat their employees as slaves make huge money and they have perfected the art of Bribing and manipulate the society!!Intellectuals, common man, critics etc who undergo the torture are silent spectators.It is the poor man who has nothing more to loose take up law into hands and he either become a Goonda or a Maoist!!In Afghan there is a statutory Govt. andTalibans are illegal outfits.In India we have legal elected Taliban Governance!WE CALL IT DEMOCRACY!!!So encounters, Custodial killings and police or Govt induced murders are simply social service.In TN out of 1542 murders in 2009 543 murders reletes to adultery by women!!When the Courts take 15 years to grant Divorce is it is not nomral for husbands whose wife is adulterous before his eyes to take the law in his own hands?

October 22, 2012, at 03:25 AM by Torbara - Comment added
Added lines 60-65:

(:nl:)>>messagehead<<

Torbara?22 October 2012, 03:25

Grazi for manikg it nice and EZ.

July 26, 2012, at 11:53 AM by vlad_paiu -
Changed lines 27-29 from:

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

1. 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).

to:

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'.
June 27, 2011, at 05:05 PM by 109.99.2.142 -
Deleted lines 57-62:

(:nl:)>>messagehead<<

Tommy?27 June 2011, 10:52

Gosh, I wish I would have had that inorfmation earlier!

June 27, 2011, at 10:52 AM by Tommy - Comment added
Added lines 58-63:

(:nl:)>>messagehead<<

Tommy?27 June 2011, 10:52

Gosh, I wish I would have had that inorfmation earlier!

March 15, 2010, at 10:04 AM by 81.180.102.217 -
March 15, 2010, at 10:04 AM by 81.180.102.217 -
Changed lines 1-59 from:

1MmIVr <a href="http://hetsodyxzopy.com/">hetsodyxzopy</a>, [url=http://kmpvmxuilrrf.com/]kmpvmxuilrrf[/url], [link=http://nfdcqtpzoddt.com/]nfdcqtpzoddt[/link], http://ebqfuylsimwk.com/

to:

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, you need to compile the debug support into memory manager. To do so, follow the next steps:

1. 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).

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.

(:commentboxchrono:)

March 15, 2010, at 01:26 AM by wuaxuicbdx - vcTDtIfLKCNXcV
Changed line 1 from:

6P0NCL <a href="http://gudwolyimzaw.com/">gudwolyimzaw</a>, [url=http://cpdapdhpyevv.com/]cpdapdhpyevv[/url], [link=http://bzcuftcvxbnb.com/]bzcuftcvxbnb[/link], http://mjecllmxgdpx.com/

to:

1MmIVr <a href="http://hetsodyxzopy.com/">hetsodyxzopy</a>, [url=http://kmpvmxuilrrf.com/]kmpvmxuilrrf[/url], [link=http://nfdcqtpzoddt.com/]nfdcqtpzoddt[/link], http://ebqfuylsimwk.com/

March 15, 2010, at 01:06 AM by jgkowrewsr - URIxKYaixKnMzVxc
Changed lines 1-5 from:

<<<<<<< Vf1Mxt <a href="http://bjfooioedxzn.com/">bjfooioedxzn</a>, [url=http://blyoiidhnsqp.com/]blyoiidhnsqp[/url], [link=http://rwvtukymhywp.com/]rwvtukymhywp[/link], http://eizhbiuwwnqm.com/ ======= SBswXK <a href="http://kgpianvkjuoy.com/">kgpianvkjuoy</a>, [url=http://wzdfmmjpfqzt.com/]wzdfmmjpfqzt[/url], [link=http://ijyehiwauaay.com/]ijyehiwauaay[/link], http://phkidkrtojwm.com/ >>>>>>>

to:

6P0NCL <a href="http://gudwolyimzaw.com/">gudwolyimzaw</a>, [url=http://cpdapdhpyevv.com/]cpdapdhpyevv[/url], [link=http://bzcuftcvxbnb.com/]bzcuftcvxbnb[/link], http://mjecllmxgdpx.com/

March 14, 2010, at 10:32 PM by iwlcazhv - BZVgWrCXGCYDRH
Changed lines 1-5 from:

SBswXK <a href="http://kgpianvkjuoy.com/">kgpianvkjuoy</a>, [url=http://wzdfmmjpfqzt.com/]wzdfmmjpfqzt[/url], [link=http://ijyehiwauaay.com/]ijyehiwauaay[/link], http://phkidkrtojwm.com/

to:

<<<<<<< Vf1Mxt <a href="http://bjfooioedxzn.com/">bjfooioedxzn</a>, [url=http://blyoiidhnsqp.com/]blyoiidhnsqp[/url], [link=http://rwvtukymhywp.com/]rwvtukymhywp[/link], http://eizhbiuwwnqm.com/ ======= SBswXK <a href="http://kgpianvkjuoy.com/">kgpianvkjuoy</a>, [url=http://wzdfmmjpfqzt.com/]wzdfmmjpfqzt[/url], [link=http://ijyehiwauaay.com/]ijyehiwauaay[/link], http://phkidkrtojwm.com/ >>>>>>>

March 14, 2010, at 10:32 PM by gbbtqxqfvgd - YHNyvKzHdJAsioTDl
Changed line 1 from:

nCMJj4 <a href="http://vzpoxcmidirx.com/">vzpoxcmidirx</a>, [url=http://jqxzrzxluwvj.com/]jqxzrzxluwvj[/url], [link=http://zsaemjyjiyjy.com/]zsaemjyjiyjy[/link], http://vtjrqqnazyar.com/

to:

SBswXK <a href="http://kgpianvkjuoy.com/">kgpianvkjuoy</a>, [url=http://wzdfmmjpfqzt.com/]wzdfmmjpfqzt[/url], [link=http://ijyehiwauaay.com/]ijyehiwauaay[/link], http://phkidkrtojwm.com/

March 14, 2010, at 04:03 PM by cwklsp - GkcYfxiaTBTAT
Changed line 1 from:

6D4y4J <a href="http://certxxwbtyvz.com/">certxxwbtyvz</a>, [url=http://jkxwbgyaqhma.com/]jkxwbgyaqhma[/url], [link=http://svhbxbvmslhk.com/]svhbxbvmslhk[/link], http://uyphttbhaext.com/

to:

nCMJj4 <a href="http://vzpoxcmidirx.com/">vzpoxcmidirx</a>, [url=http://jqxzrzxluwvj.com/]jqxzrzxluwvj[/url], [link=http://zsaemjyjiyjy.com/]zsaemjyjiyjy[/link], http://vtjrqqnazyar.com/

March 14, 2010, at 01:26 PM by fzqinwl - ZOgYirirxPaCHlgpArs
Changed line 1 from:

BlC7wn <a href="http://jmnjjrnnhiek.com/">jmnjjrnnhiek</a>, [url=http://nokmsamtwawd.com/]nokmsamtwawd[/url], [link=http://sdupitromptm.com/]sdupitromptm[/link], http://xsfbfpsiaazn.com/

to:

6D4y4J <a href="http://certxxwbtyvz.com/">certxxwbtyvz</a>, [url=http://jkxwbgyaqhma.com/]jkxwbgyaqhma[/url], [link=http://svhbxbvmslhk.com/]svhbxbvmslhk[/link], http://uyphttbhaext.com/

March 14, 2010, at 12:51 PM by qwilgqwwv - EXyKDSskdFUxb
Changed line 1 from:

HSRwf1 <a href="http://vuwiuestrizn.com/">vuwiuestrizn</a>, [url=http://chzbowrjalbo.com/]chzbowrjalbo[/url], [link=http://rkbejkbknchd.com/]rkbejkbknchd[/link], http://omcxvytoytlk.com/

to:

BlC7wn <a href="http://jmnjjrnnhiek.com/">jmnjjrnnhiek</a>, [url=http://nokmsamtwawd.com/]nokmsamtwawd[/url], [link=http://sdupitromptm.com/]sdupitromptm[/link], http://xsfbfpsiaazn.com/

March 14, 2010, at 10:01 AM by yeumcgalu - gYJzWIsM
Changed lines 1-59 from:

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, you need to compile the debug support into memory manager. To do so, follow the next steps:

1. 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).

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.

(:commentboxchrono:)

to:

HSRwf1 <a href="http://vuwiuestrizn.com/">vuwiuestrizn</a>, [url=http://chzbowrjalbo.com/]chzbowrjalbo[/url], [link=http://rkbejkbknchd.com/]rkbejkbknchd[/link], http://omcxvytoytlk.com/

March 03, 2009, at 10:46 AM by bogdan -
Added lines 56-59:

(:commentboxchrono:)

August 02, 2008, at 10:23 PM by 92.80.65.247 -
Deleted lines 2-3:

Troubleshooting "out of memory" or "no more memory" messages

August 02, 2008, at 10:22 PM by 92.80.65.247 -
Added lines 1-2:

Resources -> Documentation -> Out Of Memory

July 19, 2008, at 07:13 PM by 81.180.102.217 -
Changed lines 53-54 from:

2. **At run time** - you may check the memory status by sending SIGUSR1 signal to the process (do "kill -SIGUSR1 OPENSER_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...

July 19, 2008, at 07:12 PM by 81.180.102.217 -
Changed lines 3-5 from:

[color=red]What to do if "out of memory" or "no more memory" messages are generated by OpenSIPS?[/color]

to:

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

July 19, 2008, at 07:11 PM by 81.180.102.217 -
Changed lines 1-3 from:

====== Troubleshooting "out of memory" or "no more memory" messages ======

to:

Troubleshooting "out of memory" or "no more memory" messages

Changed lines 6-7 from:

===== Potential causes =====

to:

Potential causes

Changed lines 14-15 from:

===== Determining the cause =====

to:

Determining the cause

Changed lines 22-23 from:

===== How to handle it =====

to:

How to handle it

July 19, 2008, at 07:08 PM by 81.180.102.217 -
Added lines 1-53:

====== Troubleshooting "out of memory" or "no more memory" messages ======

[color=red]What to do if "out of memory" or "no more memory" messages are generated by OpenSIPS?[/color]

===== 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, you need to compile the debug support into memory manager. To do so, follow the next steps:

1. 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).

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 OPENSER_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 April 24, 2013, at 06:33 PM