Details
Description
If chan_skinny is flooded with requests, asterisk will quickly escalate virtual memory (but not resident memory) to the point where no new memory allocations are possible.
Issue Links
- is a clone of
-
SWP-10099 Loading...
Analysis:
chan_skinny creates a new thread for each new session. In trying to be a good cleanup citizen, the threads are joinable and the unload_module function does a pthread_cancel() and a pthread_join() on any sessions that are active at that time. This has an unintended side effect though. Since you can call pthread_join on a thread that's already terminated, pthreads keeps the thread's storage around until you explicitly call pthread_join (or pthread_detach()). Since only the module_unload function was calling pthread_join, and even then only on the ones active at the tme, the storage for every thread/session ever created sticks around until asterisk exits.
The solution was just to have every thread call pthread_detach() on itself before exiting.