<div dir="ltr">On the contrary, the lock seems to be needed. I found quite a few bugs in media_exchange, seems like msl can be changed in other threads, etc which causes segfault. in this case also I ended up in this part of code because of a segfault and adding lock seems to fix it.</div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Oct 9, 2025 at 2:28 PM Răzvan Crainea <<a href="mailto:razvan@opensips.org">razvan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Pretty sure the lock is not needed at all - can you please open a BUG <br>
report, so we can investigate a bit how to properly handle the <br>
termination case?<br>
<br>
Best regards,<br>
<br>
Răzvan Crainea<br>
OpenSIPS Core Developer / SIPhub CTO<br>
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a> / <a href="https://www.siphub.com" rel="noreferrer" target="_blank">https://www.siphub.com</a><br>
<br>
On 10/6/25 1:27 PM, M S wrote:<br>
> Hi Opensips developers,<br>
> While going through media_exchang.c code:<br>
> <br>
> static int b2b_media_notify(struct sip_msg *msg, str *key, int type,<br>
> str *logic_key, void *param, int flags)<br>
> {<br>
> ....<br>
> terminate:<br>
> *MEDIA_LEG_LOCK(msl);*<br>
> if (initial_state == MEDIA_SESSION_STATE_INIT) {<br>
> /* this is the initial leg, not a re-invite */<br>
> *MEDIA_LEG_UNLOCK(msl);*<br>
> handle_media_session_negative(msl);<br>
> } else {<br>
> *MEDIA_LEG_UNLOCK(msl);*<br>
> }<br>
> return -1;<br>
> }<br>
> <br>
> there is no point in lock and unlock above.... unless the first unlock is<br>
> supposed to be after handle_media_session_negative(msl);?<br>
> <br>
> Thanks!<br>
> <br>
> <br>
> Hi Opensips developers,<br>
> While going through media_exchang.c code:<br>
> <br>
> static int b2b_media_notify(struct sip_msg *msg, str *key, int type,<br>
> str *logic_key, void *param, int flags)<br>
> {<br>
> ....<br>
> terminate:<br>
> *MEDIA_LEG_LOCK(msl);*<br>
> if (initial_state == MEDIA_SESSION_STATE_INIT) {<br>
> /* this is the initial leg, not a re-invite */<br>
> *MEDIA_LEG_UNLOCK(msl);*<br>
> handle_media_session_negative(msl);<br>
> } else {<br>
> *MEDIA_LEG_UNLOCK(msl);*<br>
> }<br>
> return -1;<br>
> }<br>
> <br>
> there is no point in lock and unlock above.... unless the first <br>
> unlock is supposed to be after handle_media_session_negative(msl);?<br>
> <br>
> Thanks!<br>
> <br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>