<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2834/">https://reviewboard.asterisk.org/r/2834/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers.</div>
<div>By Matt Jordan.</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">While playing around with Asterisk, I managed to tell it to load res_pjsip and friends with no sorcery wizards loaded. This resulted in the following crash:
Thread 1 (Thread 0x7f1af1ada760 (LWP 6119)):
#0 ast_threadpool_push (pool=0x0, task=0x7f1aba1d0880 <sync_task>, data=0x7fff1e4157a0)
at threadpool.c:896
#1 0x00007f1aba1d2aec in ast_sip_push_task_synchronous (serializer=0x0,
sip_task=0x7f1aba1d0f70 <unregister_service>, task_data=0x7fff1e415858) at res_pjsip.c:1694
#2 0x00007f1aba1d2b7c in ast_sip_unregister_service (module=0x7f1aba3e4180) at res_pjsip.c:1050
#3 0x00007f1aba1d7820 in ast_sip_destroy_distributor () at res_pjsip/pjsip_distributor.c:368
#4 0x00007f1aba1d0c7a in load_module () at res_pjsip.c:1886
#5 load_module () at res_pjsip.c:1803
#6 0x000000000051420f in start_resource (mod=0x1771800) at loader.c:971
#7 0x0000000000514a5a in start_resource (mod=<optimized out>) at loader.c:964
#8 load_resource_list (load_order=0x7fff1e415a80, global_symbols=1, mod_count=0x7fff1e415a9c)
at loader.c:1174
#9 0x000000000051661a in load_modules (preload_only=<optimized out>) at loader.c:1322
#10 0x000000000042ffdd in main (argc=<optimized out>, argv=<optimized out>) at asterisk.c:4431
Basically, since sorcery can't load the configuration, you jump to the error: label and call ast_sip_destroy_distributor with no threadpool allocated. Kerblooey.
This patch checks for this in ast_sip_unregister_service, which feels like the most appropriate place as you shouldn't push a task to unregister a service if you don't have a serializer/threadpool. I'm open to other suggestions on where to catch this however.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/branches/12/res/res_pjsip.c <span style="color: grey">(398627)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2834/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>