New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
* [Core] Fix possible deadlock in switch_core_media_set_codec() This commit results in a deadlock #2290
Comments
SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t ...
This will solve the problem |
It seems you can reproduce it on demand. Can you please provide a way to reproduce this (dialplan, maybe unit-tests, etc) ? |
The reasons for this problem are: Thread 3 The solution to this problem is to change switch_core_session_receive_message to switch_core_session_queue_message |
he told me it happens every day 3-10 locked channels on a production system. #2300 fixed his problem, but if we have new patch we can ask him to test. |
…ING_NECESSARY that we should be following this code path, but it does not look like there's anything that gets changed when we enter sofia_receive_message() in this case. Thus there's no sense in locking tech_pvt->sofia_mutex , thus avoiding the deadlock described in issue signalwire#2290.
I just pushed a patch and created a PR that at least fixes the deadlock. I cannot say with all certainty that we should even be in sofia_receive_message() when this deadlock occurs, but at least this prevents unnecessary locking of the tech_pvt->sofia_mutex. |
SHA-1: b4e4321
This commit results in a deadlock
Thread 3
switch_core_session_read_frame
switch_mutex_lock(session->codec_read_mutex);
sofia_receive_message
switch_mutex_lock(tech_pvt->sofia_mutex);
switch_core_media_set_codec
switch_core_session_lock_codec_write(session);
switch_core_session_lock_codec_read(session);
Thread 2
switch_core_session_write_frame
switch_mutex_lock(session->codec_write_mutex);
sofia_receive_message
switch_mutex_lock(tech_pvt->sofia_mutex);
The text was updated successfully, but these errors were encountered: