Skip to content

Commit 788fd65

Browse files
committed
research stack overflow
1 parent 7996f7a commit 788fd65

File tree

4 files changed

+32
-4
lines changed

4 files changed

+32
-4
lines changed

core/src/abstract_executor.rs

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ pub trait AsyncListener {
6363
fn local_addr(&self) -> Result<SocketAddr, io::Error>;
6464
}
6565

66+
67+
//TODO: telemetry isprobably broken because Handle is not workng abstracted?
68+
6669
impl AsyncListener for nuclei::Handle<TcpListener> {
6770
fn accept<'a>(&'a self) -> Pin<Box<dyn Future<Output = Result<(Box<dyn AsyncReadWrite + Send + Unpin + 'static>, Option<SocketAddr>), io::Error>> + Send + 'a>> {
6871
let fut = self.accept(); // Provided by nuclei::Handle<TcpListener>

core/src/commander_monitor.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
2-
use log::{warn};
2+
use log::{error, warn};
33
use std::time::{Duration, Instant};
44
use std::sync::Arc;
55
use parking_lot::RwLock;
@@ -128,11 +128,21 @@ impl<const RXL: usize, const TXL: usize> LocalMonitor<RXL, TXL> {
128128

129129
//TODO: check usage and add to the SteadyState
130130
pub(crate) async fn internal_wait_shutdown(&self) -> bool {
131+
error!("expecting hang 8");
132+
131133
let one_shot = &self.oneshot_shutdown;
134+
132135
let mut guard = one_shot.lock().await;
136+
error!("expecting hang 9");
137+
133138
if !guard.is_terminated() {
139+
error!("expecting hang A");
140+
134141
let _ = guard.deref_mut().await;
142+
error!("expecting hang B");
143+
135144
}
145+
error!("hep inernal shutdwon conffed");
136146
true
137147
}
138148

@@ -926,10 +936,15 @@ impl<const RX_LEN: usize, const TX_LEN: usize> SteadyCommander for LocalMonitor<
926936
/// uses opposite boolean as others since we are asking for shutdown
927937
/// returns true upon shutdown detection
928938
async fn wait_shutdown(&self) -> bool {
939+
error!("expecting hang 5");
940+
929941
let _guard = self.start_profile(CALL_OTHER);
930942
if self.telemetry.is_dirty() {
943+
error!("expecting hang 6.0");
944+
931945
let remaining_micros = self.telemetry_remaining_micros();
932-
if remaining_micros <= 0 {
946+
if remaining_micros <= 0 && self.is_liveliness_running() {
947+
error!("need relay before shutdown?? if so check liveliness");
933948
false //need a relay now so return
934949
} else {
935950
let dur = Delay::new(Duration::from_micros(remaining_micros as u64));
@@ -940,6 +955,8 @@ impl<const RX_LEN: usize, const TX_LEN: usize> SteadyCommander for LocalMonitor<
940955
}
941956
}
942957
} else {
958+
error!("expecting hang 6.1");
959+
943960
self.internal_wait_shutdown().await
944961
}
945962
}

core/src/graph_liveliness.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ impl GraphLiveliness {
208208
//Target actor may have already stopped so this is not an error
209209
}
210210
});
211-
//trace!("every actor has had one shot shutdown fired now");
211+
error!("every actor has had one shot shutdown fired now");
212212
} else if self.is_in_state(&[GraphLivelinessState::Building]) {
213213
warn!("request_stop should only be called after start");
214214
}
@@ -461,7 +461,7 @@ impl GraphBuilder {
461461
GraphBuilder {
462462
block_fail_fast: false,
463463
telemetry_metric_features: false,
464-
enable_io_driver: true,
464+
enable_io_driver: false,
465465
backplane: Some(SideChannelHub::default()),
466466
proactor_config: Some(ProactorConfig::InterruptDriven),
467467
iouring_queue_length: 1<<5,
@@ -504,6 +504,9 @@ impl GraphBuilder {
504504
pub fn with_telemetry_metric_features(&self, enable: bool) -> Self {
505505
let mut result = self.clone();
506506
result.telemetry_metric_features = enable;
507+
if enable {
508+
result.enable_io_driver = true;
509+
}
507510
result
508511
}
509512

core/src/monitor.rs

+5
Original file line numberDiff line numberDiff line change
@@ -956,11 +956,15 @@ pub(crate) mod monitor_tests {
956956
// Simulate shutdown
957957
{
958958
let mut liveliness = monitor.runtime_state.write();
959+
liveliness.state = GraphLivelinessState::Running;
959960
liveliness.request_shutdown();
960961
}
961962
error!("expecting hang 3");
962963

963964
let result = monitor.wait_shutdown().await;
965+
966+
error!("expecting hang 4 {}",result);
967+
964968
assert!(result);
965969
}
966970

@@ -1141,6 +1145,7 @@ pub(crate) mod monitor_tests {
11411145
// // Request shutdown
11421146
// {
11431147
// let mut liveliness = monitor.runtime_state.write();
1148+
// liveliness.state = GraphLivelinessState::Running;
11441149
// liveliness.request_shutdown();
11451150
// }
11461151
//

0 commit comments

Comments
 (0)