addl debug

This commit is contained in:
ModulatingForce 2024-03-30 14:26:39 -04:00
parent 0625e7f091
commit 745ac91522
2 changed files with 30 additions and 6 deletions

View file

@ -56,7 +56,7 @@ impl ExecBodyParams {
let curr_act = Arc::clone(&self.curr_act);
let parent_act_lock = curr_act.read().await;
let act = &(*parent_act_lock);
match act {
let out = match act {
BotAction::C(_) => {
// let temp = c.module.clone();
// Some(temp)
@ -72,10 +72,20 @@ impl ExecBodyParams {
// let temp = r.module.clone();
// Some(temp)
dbg!("Core > ExecBodyParams > GetChannels - routine identified");
Some(r.read().await.channel.clone())
dbg!(">> BotActionAR - RwLock from botmodules.rs::929:46 - current_readers = 1 ");
dbg!(">> RoutineAR - RwLock from botmodules.rs::1261:32 - current_readers = 1");
dbg!(">> join_handle - RwLock from botmodules.rs::1226:46 - current_readers = 0");
dbg!(">> BotInstanceAR - RwLock from botinstance.rs::150:28 - current_readers = 3 ");
// => 03.30 - Just before deadlock
let out = Some(r.read().await.channel.clone());
// => 03.30 - This isn't reached because of the Deadlock
dbg!(">> Just after Potential Deadlock Lock");
out
}
// _ => None
}
};
out
}

View file

@ -1221,9 +1221,11 @@ impl Routine {
{ // Recommendation to ensure a clean update is to use one write() lock that was awaited
// - We can isolate the write lock by ensuring it's in it's own block
let mut lock = trg_routine_arout.write().await;
// => 03.30 - involved with Problem Deadlock Current Readers = 0
let mut lock = trg_routine_arout.write().await;
lock.join_handle = Some(Arc::new(RwLock::new(join_handle)));
lock.internal_signal = RoutineSignal::Started;
drop(lock); // => 03.30 - added this to try to address Deadlock issue
}
trg_routine_arout.write().await.internal_signal = RoutineSignal::Started;
@ -1236,6 +1238,11 @@ impl Routine {
// (routine.exec_body)(params).await;
// }
// fn (){
// }
async fn loopbody(&mut self)
// [x] => 03.27 - COMPLETED
{
@ -1248,14 +1255,18 @@ impl Routine {
);
Log::flush();
let self_ar = Arc::new(RwLock::new(self));
// => 03.30 - involved with Problem Deadlock Current Readers = 1
// - Below self appears to be a Arc<RwLock<&mut Routine>>
let self_ar = Arc::new(RwLock::new(self));
{
let mut mutlock = self_ar.write().await;
mutlock.parent_params.parent_act = Some(mutlock.parent_params.curr_act.clone());
mutlock.parent_params.curr_act = mutlock.self_act_ar.to_owned().unwrap();
drop(mutlock); // => 03.30 - Added to address Deadlock issue
}
dbg!("Core > Before Guards");
@ -1275,6 +1286,9 @@ impl Routine {
};
dbg!("Core > Guarding & Executing Child Execution Body");
dbg!(">> BotActionAR - RwLock from botmodules.rs::929:46 - current_readers = 0 ");
dbg!(">> RoutineAR - RwLock from botmodules.rs::1261:32 - current_readers = Not Listed");
dbg!(">> BotInstanceAR - RwLock from botinstance.rs::150:28 - current_readers = 3 ");
{
let guard2 = self_ar.read().await;