Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
M
mediasoup
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
聂卓夫
mediasoup
Commits
8e1f2381
提交
8e1f2381
authored
12月 12, 2021
作者:
Nazar Mokrynskyi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix rare deadlock caused by another path of dropping subscription handlers
上级
45ac3977
显示空白字符变更
内嵌
并排
正在显示
9 个修改的文件
包含
92 行增加
和
14 行删除
+92
-14
active_speaker_observer.rs
rust/src/router/active_speaker_observer.rs
+10
-1
audio_level_observer.rs
rust/src/router/audio_level_observer.rs
+10
-1
consumer.rs
rust/src/router/consumer.rs
+11
-3
data_consumer.rs
rust/src/router/data_consumer.rs
+10
-2
direct_transport.rs
rust/src/router/direct_transport.rs
+10
-2
pipe_transport.rs
rust/src/router/pipe_transport.rs
+10
-1
plain_transport.rs
rust/src/router/plain_transport.rs
+10
-1
producer.rs
rust/src/router/producer.rs
+11
-2
webrtc_transport.rs
rust/src/router/webrtc_transport.rs
+10
-1
没有找到文件。
rust/src/router/active_speaker_observer.rs
浏览文件 @
8e1f2381
...
@@ -105,6 +105,8 @@ impl Inner {
...
@@ -105,6 +105,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
RtpObserverCloseRequest
{
let
request
=
RtpObserverCloseRequest
{
...
@@ -113,7 +115,6 @@ impl Inner {
...
@@ -113,7 +115,6 @@ impl Inner {
rtp_observer_id
:
self
.id
,
rtp_observer_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -126,6 +127,14 @@ impl Inner {
...
@@ -126,6 +127,14 @@ impl Inner {
drop
(
subscription_handler
);
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
.detach
();
}
}
}
}
}
}
...
...
rust/src/router/audio_level_observer.rs
浏览文件 @
8e1f2381
...
@@ -116,6 +116,8 @@ impl Inner {
...
@@ -116,6 +116,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
RtpObserverCloseRequest
{
let
request
=
RtpObserverCloseRequest
{
...
@@ -124,7 +126,6 @@ impl Inner {
...
@@ -124,7 +126,6 @@ impl Inner {
rtp_observer_id
:
self
.id
,
rtp_observer_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -137,6 +138,14 @@ impl Inner {
...
@@ -137,6 +138,14 @@ impl Inner {
drop
(
subscription_handler
);
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
.detach
();
}
}
}
}
}
}
...
...
rust/src/router/consumer.rs
浏览文件 @
8e1f2381
...
@@ -397,6 +397,8 @@ impl Inner {
...
@@ -397,6 +397,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
ConsumerCloseRequest
{
let
request
=
ConsumerCloseRequest
{
...
@@ -407,8 +409,6 @@ impl Inner {
...
@@ -407,8 +409,6 @@ impl Inner {
producer_id
:
self
.producer_id
,
producer_id
:
self
.producer_id
,
},
},
};
};
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
let
weak_producer
=
self
.weak_producer
.clone
();
let
weak_producer
=
self
.weak_producer
.clone
();
self
.executor
self
.executor
...
@@ -417,11 +417,19 @@ impl Inner {
...
@@ -417,11 +417,19 @@ impl Inner {
if
let
Err
(
error
)
=
channel
.request
(
request
)
.await
{
if
let
Err
(
error
)
=
channel
.request
(
request
)
.await
{
error!
(
"consumer closing failed on drop: {}"
,
error
);
error!
(
"consumer closing failed on drop: {}"
,
error
);
}
}
}
// Drop from a different thread to avoid deadlock with recursive dropping
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
// from within another subscription drop.
drop
(
subscription_handlers
);
drop
(
subscription_handlers
);
}
})
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handlers
);
})
})
.detach
();
.detach
();
}
}
...
...
rust/src/router/data_consumer.rs
浏览文件 @
8e1f2381
...
@@ -227,6 +227,8 @@ impl Inner {
...
@@ -227,6 +227,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
DataConsumerCloseRequest
{
let
request
=
DataConsumerCloseRequest
{
...
@@ -237,8 +239,6 @@ impl Inner {
...
@@ -237,8 +239,6 @@ impl Inner {
data_producer_id
:
self
.data_producer_id
,
data_producer_id
:
self
.data_producer_id
,
},
},
};
};
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
let
weak_data_producer
=
self
.weak_data_producer
.clone
();
let
weak_data_producer
=
self
.weak_data_producer
.clone
();
self
.executor
self
.executor
...
@@ -254,6 +254,14 @@ impl Inner {
...
@@ -254,6 +254,14 @@ impl Inner {
drop
(
subscription_handlers
);
drop
(
subscription_handlers
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handlers
);
})
.detach
();
}
}
}
}
}
}
...
...
rust/src/router/direct_transport.rs
浏览文件 @
8e1f2381
...
@@ -166,6 +166,8 @@ impl Inner {
...
@@ -166,6 +166,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
TransportCloseRequest
{
let
request
=
TransportCloseRequest
{
...
@@ -174,8 +176,6 @@ impl Inner {
...
@@ -174,8 +176,6 @@ impl Inner {
transport_id
:
self
.id
,
transport_id
:
self
.id
,
},
},
};
};
let
subscription_handlers
:
Vec
<
_
>
=
mem
::
take
(
&
mut
self
.subscription_handlers
.lock
());
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -188,6 +188,14 @@ impl Inner {
...
@@ -188,6 +188,14 @@ impl Inner {
drop
(
subscription_handlers
);
drop
(
subscription_handlers
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handlers
);
})
.detach
()
}
}
}
}
}
}
...
...
rust/src/router/pipe_transport.rs
浏览文件 @
8e1f2381
...
@@ -217,6 +217,8 @@ impl Inner {
...
@@ -217,6 +217,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
TransportCloseRequest
{
let
request
=
TransportCloseRequest
{
...
@@ -225,7 +227,6 @@ impl Inner {
...
@@ -225,7 +227,6 @@ impl Inner {
transport_id
:
self
.id
,
transport_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -238,6 +239,14 @@ impl Inner {
...
@@ -238,6 +239,14 @@ impl Inner {
drop
(
subscription_handler
);
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
.detach
();
}
}
}
}
}
}
...
...
rust/src/router/plain_transport.rs
浏览文件 @
8e1f2381
...
@@ -254,6 +254,8 @@ impl Inner {
...
@@ -254,6 +254,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
TransportCloseRequest
{
let
request
=
TransportCloseRequest
{
...
@@ -262,7 +264,6 @@ impl Inner {
...
@@ -262,7 +264,6 @@ impl Inner {
transport_id
:
self
.id
,
transport_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -275,6 +276,14 @@ impl Inner {
...
@@ -275,6 +276,14 @@ impl Inner {
drop
(
subscription_handler
);
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
.detach
();
}
}
}
}
}
}
...
...
rust/src/router/producer.rs
浏览文件 @
8e1f2381
...
@@ -324,6 +324,8 @@ impl Inner {
...
@@ -324,6 +324,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
ProducerCloseRequest
{
let
request
=
ProducerCloseRequest
{
...
@@ -333,17 +335,24 @@ impl Inner {
...
@@ -333,17 +335,24 @@ impl Inner {
producer_id
:
self
.id
,
producer_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
if
let
Err
(
error
)
=
channel
.request
(
request
)
.await
{
if
let
Err
(
error
)
=
channel
.request
(
request
)
.await
{
error!
(
"producer closing failed on drop: {}"
,
error
);
error!
(
"producer closing failed on drop: {}"
,
error
);
}
// Drop from a different thread to avoid deadlock with recursive dropping
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
// from within another subscription drop.
drop
(
subscription_handler
);
drop
(
subscription_handler
);
}
})
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
}
...
...
rust/src/router/webrtc_transport.rs
浏览文件 @
8e1f2381
...
@@ -301,6 +301,8 @@ impl Inner {
...
@@ -301,6 +301,8 @@ impl Inner {
self
.handlers.close
.call_simple
();
self
.handlers.close
.call_simple
();
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
if
close_request
{
if
close_request
{
let
channel
=
self
.channel
.clone
();
let
channel
=
self
.channel
.clone
();
let
request
=
TransportCloseRequest
{
let
request
=
TransportCloseRequest
{
...
@@ -309,7 +311,6 @@ impl Inner {
...
@@ -309,7 +311,6 @@ impl Inner {
transport_id
:
self
.id
,
transport_id
:
self
.id
,
},
},
};
};
let
subscription_handler
=
self
.subscription_handler
.lock
()
.take
();
self
.executor
self
.executor
.spawn
(
async
move
{
.spawn
(
async
move
{
...
@@ -322,6 +323,14 @@ impl Inner {
...
@@ -322,6 +323,14 @@ impl Inner {
drop
(
subscription_handler
);
drop
(
subscription_handler
);
})
})
.detach
();
.detach
();
}
else
{
self
.executor
.spawn
(
async
move
{
// Drop from a different thread to avoid deadlock with recursive dropping
// from within another subscription drop.
drop
(
subscription_handler
);
})
.detach
();
}
}
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论