add additional logging
This commit is contained in:
parent
90db2e3ae2
commit
4ec5535f77
1 changed files with 26 additions and 15 deletions
|
|
@ -1205,25 +1205,36 @@ pub(crate) fn launch_bots_server(
|
|||
logpath.display()
|
||||
);
|
||||
}
|
||||
if let Ok(live) = live::LiveProcess::attach(pid)
|
||||
&& let Some(base) = live.base(lib)
|
||||
{
|
||||
let insts = live.find_instances(ready_vt.slot0 + base, 64);
|
||||
let ready = match pawn_health {
|
||||
Some(health) => insts
|
||||
.into_iter()
|
||||
.any(|o| live.read_i32(o + health).unwrap_or(0) > 0),
|
||||
None => !insts.is_empty(),
|
||||
};
|
||||
if ready {
|
||||
return Ok(OwnedServer { child, pid }); // ready — detach the poll handle, hand off the child
|
||||
}
|
||||
}
|
||||
// Each failure mode records WHY. Reporting only "not ready" conflates three very different causes —
|
||||
// memory unreadable, the library never mapped, and the instance simply not spawned yet — and leaves
|
||||
// the operator guessing at which.
|
||||
let why = match live::LiveProcess::attach(pid) {
|
||||
Err(e) => format!("cannot read pid {pid}'s memory: {e:#}"),
|
||||
Ok(live) => match live.base(lib) {
|
||||
None => format!("{lib} is not mapped in pid {pid}"),
|
||||
Some(base) => {
|
||||
let insts = live.find_instances(ready_vt.slot0 + base, 64);
|
||||
let ready = match pawn_health {
|
||||
Some(health) => insts
|
||||
.iter()
|
||||
.any(|&o| live.read_i32(o + health).unwrap_or(0) > 0),
|
||||
None => !insts.is_empty(),
|
||||
};
|
||||
if ready {
|
||||
return Ok(OwnedServer { child, pid }); // ready — hand off the child
|
||||
}
|
||||
match pawn_health {
|
||||
Some(_) => format!("{} instance(s) found, none alive", insts.len()),
|
||||
None => "no instance found".to_string(),
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
if std::time::Instant::now() >= deadline {
|
||||
let _ = child.kill();
|
||||
let _ = child.wait();
|
||||
anyhow::bail!(
|
||||
"not ready within {wait}s — check {} (server up? map/bots loaded?)",
|
||||
"not ready within {wait}s ({why}) — check {} (server up? map/bots loaded?)",
|
||||
logpath.display()
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue