Pool Crashes?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Norman Franke wrote:
> I did re-enable asserts, which is how I found #1 below. I think I traced 
> it to several issues:
> 
> 1. When calls end, the conference port is not automatically released. 
> Why not? After a while, 32 active connects were established and things 

It should. The idea is when a port is removed, all things related to 
this port should have been released.

> failed. After adding explicit pjsua_conf_disconnect (for each other 
> connected port to that call) that assert stopped aborting.

While we had these bugs on the conference bridge that I just fixed, 
I'm not convinced that they have any relations with the assertion in 
the pool.c:
   http://www.pjsip.org/trac/ticket/427
   http://www.pjsip.org/trac/ticket/428

But ticket #428 did cause assertion after 32 ports are removed, 
although the assertion was in conference.c rather than in pool.c.

> 2. I have a recorder that I use to record calls. I had originally used a 
> single pool for this, and then destroyed and recreated the recorder as 
> needed. Apparently, the memory was never freed 
> by pjmedia_port_destroy and the pool kept growing. After some point, it 
> would just crash (after the pool reached 1/2 to 3/4 of a MB.)  The new 
> version releases the whole pool and creates a new one when I 
> call pjmedia_my_writer_port_create.

pjmedia_port_destroy() doesn't release the pool since it doesn't own 
it, and pool's memory is never freed until the pool itself is 
destroyed, these are by design. I suspect the crash is caused by the 
pool emitting an exception which is not handled by application. 
Although if you said you enabled assertion, you should get assert() 
in pj/except.c instead of a crash (see pj_throw_exception_() function).

Fyi pool emits PJ_NO_MEMORY_EXCEPTION exception when it fails to 
allocate memory in pj_pool_alloc(). It may fail to allocate memory 
either when it's not configured to grow (the "increment" argument is 
set to zero in pj_pool_create()), or when the OS returns NULL in 
malloc().

> With these two changes, I haven't had a crash in a day. However, I'm 
> still puzzled why it crashed? I never used the pools in another thread, 
> just to create the ports.
> 
> I did try PJ_SAFE_POOL earlier and besides slowing the audio down to 
> where it was garbled, I never got an error after a large number of test 
> calls.

I'm also puzzled. The crash in pool.c that you mentioned before 
seems to suggest that the pool's internal data might have been 
reset, and I thought it may have been caused by the pool being 
released more than once, so PJ_SAFE_POOL should catch this. 
Apparently it didn't, so I'm puzzled.

  -benny


> -Norman
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


-- 
Benny Prijono
http://www.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux