Skip to content

Commit 1e25752

Browse files
authored
notif/fix: Avoid CPU busy loops on litep2p full shutdown (#521)
This PR fixes an issue that caused extensive CPU busy loops, which manifested with multiple spammed logs: ``` transport service closed transport service closed transport service closed ``` - When the litep2p backend is dropped, there's no point in keeping any zombie task active - litep2p dropping results in transport manager dropping, which invalidates any user of the transport service - to avoid polling `service.next()` in a loop to return `None` every call, this PR shuts down the notification protocols properly Part of: - paritytech/polkadot-sdk#10821 Signed-off-by: Alexandru Vasile <[email protected]>
1 parent 8aaeba4 commit 1e25752

File tree

1 file changed

+9
-1
lines changed
  • src/protocol/notification

1 file changed

+9
-1
lines changed

src/protocol/notification/mod.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,15 @@ impl NotificationProtocol {
17731773
self.on_substream_open_failure(substream, error).await;
17741774
}
17751775
Some(TransportEvent::DialFailure { peer, addresses }) => self.on_dial_failure(peer, addresses).await,
1776-
None => (),
1776+
None => {
1777+
tracing::debug!(
1778+
target: LOG_TARGET,
1779+
protocol = %self.protocol,
1780+
"transport service has exited, exiting",
1781+
);
1782+
1783+
return true;
1784+
}
17771785
},
17781786
result = self.pending_validations.select_next_some(), if !self.pending_validations.is_empty() => {
17791787
if let Err(error) = self.on_validation_result(result.0, result.1).await {

0 commit comments

Comments
 (0)