Skip to content
Snippets Groups Projects
Commit a79a88a2 authored by Aleksei Voronin's avatar Aleksei Voronin
Browse files

[*] fixed node deadlock on channel closing

parent 8ca6372c
No related branches found
No related tags found
2 merge requests!148Master,!141[*] fixed node deadlock on channel closing
Pipeline #4213 passed with stage
in 18 seconds
...@@ -697,12 +697,15 @@ void stream_dap_delete(dap_client_remote_t* sh, void * arg){ ...@@ -697,12 +697,15 @@ void stream_dap_delete(dap_client_remote_t* sh, void * arg){
} }
pthread_mutex_unlock(&s_mutex_keepalive_list); pthread_mutex_unlock(&s_mutex_keepalive_list);
pthread_rwlock_wrlock(&l_stream->rwlock); /* Until channel is closed, it may still need l_stream->rwlock, so we can't lock it here yet.
size_t i; In case of races on stream closing think about making this place more robust;
for(i=0;i<l_stream->channel_count; i++) or forbid locking l_stream->rwlock from inside of channels. */
dap_stream_ch_delete(l_stream->channel[i]); for( ;l_stream->channel_count; l_stream->channel_count--){
l_stream->channel_count = 0; dap_stream_ch_delete(l_stream->channel[l_stream->channel_count - 1]);
l_stream->channel[l_stream->channel_count - 1] = NULL;
}
pthread_rwlock_wrlock(&l_stream->rwlock);
if(l_stream->session) if(l_stream->session)
dap_stream_session_close(l_stream->session->id); dap_stream_session_close(l_stream->session->id);
l_stream->session = NULL; l_stream->session = NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment