Browse Source

Replace drop token mecanism on closed channel by leaving drop token active on the receiver side and closing sender side shared memory with a lower timeout

tags/0.3.8-rc
haixuanTao 1 year ago
parent
commit
411436d3bb
2 changed files with 4 additions and 5 deletions
  1. +1
    -2
      apis/rust/node/src/event_stream/thread.rs
  2. +3
    -3
      apis/rust/node/src/node/mod.rs

+ 1
- 2
apis/rust/node/src/event_stream/thread.rs View File

@@ -237,13 +237,12 @@ fn report_remaining_drop_tokens(
drop_tokens.push(token);
}
Err(flume::RecvTimeoutError::Timeout) => {
let duration = Duration::from_secs(2);
let duration = Duration::from_secs(1);
if since.elapsed() > duration {
tracing::warn!(
"timeout: node finished, but token {token:?} was still not \
dropped after {duration:?} -> ignoring it"
);
drop_tokens.push(token);
} else {
still_pending.push((token, rx, since, 0));
}


+ 3
- 3
apis/rust/node/src/node/mod.rs View File

@@ -409,14 +409,14 @@ impl Drop for DoraNode {
);
}

match self.drop_stream.recv_timeout(Duration::from_secs(10)) {
match self.drop_stream.recv_timeout(Duration::from_secs(2)) {
Ok(token) => {
self.sent_out_shared_memory.remove(&token);
}
Err(flume::RecvTimeoutError::Disconnected) => {
tracing::warn!(
"finished_drop_tokens channel closed while still waiting for drop tokens; \
closing {} shared memory regions that might still be used",
closing {} shared memory regions that might not yet been mapped.",
self.sent_out_shared_memory.len()
);
break;
@@ -424,7 +424,7 @@ impl Drop for DoraNode {
Err(flume::RecvTimeoutError::Timeout) => {
tracing::warn!(
"timeout while waiting for drop tokens; \
closing {} shared memory regions that might still be used",
closing {} shared memory regions that might not yet been mapped.",
self.sent_out_shared_memory.len()
);
break;


Loading…
Cancel
Save