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.
On Thu, Oct 9, 2025 at 2:28 PM Răzvan Crainea <[email protected]> wrote: > Pretty sure the lock is not needed at all - can you please open a BUG > report, so we can investigate a bit how to properly handle the > termination case? > > Best regards, > > Răzvan Crainea > OpenSIPS Core Developer / SIPhub CTO > http://www.opensips-solutions.com / https://www.siphub.com > > On 10/6/25 1:27 PM, M S wrote: > > Hi Opensips developers, > > While going through media_exchang.c code: > > > > static int b2b_media_notify(struct sip_msg *msg, str *key, int type, > > str *logic_key, void *param, int flags) > > { > > .... > > terminate: > > *MEDIA_LEG_LOCK(msl);* > > if (initial_state == MEDIA_SESSION_STATE_INIT) { > > /* this is the initial leg, not a re-invite */ > > *MEDIA_LEG_UNLOCK(msl);* > > handle_media_session_negative(msl); > > } else { > > *MEDIA_LEG_UNLOCK(msl);* > > } > > return -1; > > } > > > > there is no point in lock and unlock above.... unless the first unlock is > > supposed to be after handle_media_session_negative(msl);? > > > > Thanks! > > > > > > Hi Opensips developers, > > While going through media_exchang.c code: > > > > static int b2b_media_notify(struct sip_msg *msg, str *key, int type, > > str *logic_key, void *param, int flags) > > { > > .... > > terminate: > > *MEDIA_LEG_LOCK(msl);* > > if (initial_state == MEDIA_SESSION_STATE_INIT) { > > /* this is the initial leg, not a re-invite */ > > *MEDIA_LEG_UNLOCK(msl);* > > handle_media_session_negative(msl); > > } else { > > *MEDIA_LEG_UNLOCK(msl);* > > } > > return -1; > > } > > > > there is no point in lock and unlock above.... unless the first > > unlock is supposed to be after handle_media_session_negative(msl);? > > > > Thanks! > > > > _______________________________________________ > > Users mailing list > > [email protected] > > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users >
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
