mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 13:11:31 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
d469da4d9b | |||
99091df3cf |
@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.0.15](https://github.com/edera-dev/krata/compare/v0.0.14...v0.0.15) - 2024-08-06
|
||||
|
||||
### Fixed
|
||||
- *(zone)* waitpid should be limited when no child processes exist (fixes [#304](https://github.com/edera-dev/krata/pull/304)) ([#305](https://github.com/edera-dev/krata/pull/305))
|
||||
|
||||
## [0.0.14](https://github.com/edera-dev/krata/compare/v0.0.13...v0.0.14) - 2024-08-06
|
||||
|
||||
### Added
|
||||
|
30
Cargo.lock
generated
30
Cargo.lock
generated
@ -1281,7 +1281,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -1321,7 +1321,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-buildtools"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"env_logger",
|
||||
@ -1336,7 +1336,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-ctl"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
@ -1366,7 +1366,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-daemon"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-stream",
|
||||
@ -1395,14 +1395,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-loopdev"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "krata-network"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-trait",
|
||||
@ -1426,7 +1426,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-oci"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"async-compression",
|
||||
@ -1453,7 +1453,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-runtime"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"backhand",
|
||||
@ -1494,7 +1494,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xencall"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"env_logger",
|
||||
"libc",
|
||||
@ -1507,7 +1507,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xenclient"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"env_logger",
|
||||
@ -1525,7 +1525,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xenevtchn"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
@ -1536,7 +1536,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xengnt"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"nix 0.29.0",
|
||||
@ -1545,7 +1545,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xenplatform"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"c2rust-bitfields",
|
||||
@ -1568,7 +1568,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-xenstore"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"env_logger",
|
||||
@ -1580,7 +1580,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "krata-zone"
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cgroups-rs",
|
||||
|
@ -18,7 +18,7 @@ members = [
|
||||
resolver = "2"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.0.14"
|
||||
version = "0.0.15"
|
||||
homepage = "https://krata.dev"
|
||||
license = "Apache-2.0"
|
||||
repository = "https://github.com/edera-dev/krata"
|
||||
|
@ -16,7 +16,7 @@ oci-spec = { workspace = true }
|
||||
scopeguard = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
tokio-stream = { workspace = true }
|
||||
krata-oci = { path = "../oci", version = "^0.0.14" }
|
||||
krata-oci = { path = "../oci", version = "^0.0.15" }
|
||||
krata-tokio-tar = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
|
||||
|
@ -20,7 +20,7 @@ env_logger = { workspace = true }
|
||||
fancy-duration = { workspace = true }
|
||||
human_bytes = { workspace = true }
|
||||
indicatif = { workspace = true }
|
||||
krata = { path = "../krata", version = "^0.0.14" }
|
||||
krata = { path = "../krata", version = "^0.0.15" }
|
||||
log = { workspace = true }
|
||||
prost-reflect = { workspace = true, features = ["serde"] }
|
||||
prost-types = { workspace = true }
|
||||
|
@ -17,9 +17,9 @@ circular-buffer = { workspace = true }
|
||||
clap = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
krata = { path = "../krata", version = "^0.0.14" }
|
||||
krata-oci = { path = "../oci", version = "^0.0.14" }
|
||||
krata-runtime = { path = "../runtime", version = "^0.0.14" }
|
||||
krata = { path = "../krata", version = "^0.0.15" }
|
||||
krata-oci = { path = "../oci", version = "^0.0.15" }
|
||||
krata-runtime = { path = "../runtime", version = "^0.0.15" }
|
||||
log = { workspace = true }
|
||||
prost = { workspace = true }
|
||||
redb = { workspace = true }
|
||||
|
@ -16,7 +16,7 @@ clap = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
etherparse = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
krata = { path = "../krata", version = "^0.0.14" }
|
||||
krata = { path = "../krata", version = "^0.0.15" }
|
||||
krata-advmac = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
@ -12,20 +12,20 @@ resolver = "2"
|
||||
anyhow = { workspace = true }
|
||||
backhand = { workspace = true }
|
||||
ipnetwork = { workspace = true }
|
||||
krata = { path = "../krata", version = "^0.0.14" }
|
||||
krata = { path = "../krata", version = "^0.0.15" }
|
||||
krata-advmac = { workspace = true }
|
||||
krata-oci = { path = "../oci", version = "^0.0.14" }
|
||||
krata-oci = { path = "../oci", version = "^0.0.15" }
|
||||
log = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
uuid = { workspace = true }
|
||||
krata-loopdev = { path = "../loopdev", version = "^0.0.14" }
|
||||
krata-xencall = { path = "../xen/xencall", version = "^0.0.14" }
|
||||
krata-xenclient = { path = "../xen/xenclient", version = "^0.0.14" }
|
||||
krata-xenevtchn = { path = "../xen/xenevtchn", version = "^0.0.14" }
|
||||
krata-xengnt = { path = "../xen/xengnt", version = "^0.0.14" }
|
||||
krata-xenplatform = { path = "../xen/xenplatform", version = "^0.0.14" }
|
||||
krata-xenstore = { path = "../xen/xenstore", version = "^0.0.14" }
|
||||
krata-loopdev = { path = "../loopdev", version = "^0.0.15" }
|
||||
krata-xencall = { path = "../xen/xencall", version = "^0.0.15" }
|
||||
krata-xenclient = { path = "../xen/xenclient", version = "^0.0.15" }
|
||||
krata-xenevtchn = { path = "../xen/xenevtchn", version = "^0.0.15" }
|
||||
krata-xengnt = { path = "../xen/xengnt", version = "^0.0.15" }
|
||||
krata-xenplatform = { path = "../xen/xenplatform", version = "^0.0.15" }
|
||||
krata-xenstore = { path = "../xen/xenstore", version = "^0.0.15" }
|
||||
walkdir = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
|
||||
|
@ -13,9 +13,9 @@ async-trait = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
krata-xencall = { path = "../xencall", version = "^0.0.14" }
|
||||
krata-xenplatform = { path = "../xenplatform", version = "^0.0.14" }
|
||||
krata-xenstore = { path = "../xenstore", version = "^0.0.14" }
|
||||
krata-xencall = { path = "../xencall", version = "^0.0.15" }
|
||||
krata-xenplatform = { path = "../xenplatform", version = "^0.0.15" }
|
||||
krata-xenstore = { path = "../xenstore", version = "^0.0.15" }
|
||||
regex = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
tokio = { workspace = true }
|
||||
|
@ -16,7 +16,7 @@ flate2 = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
krata-xencall = { path = "../xencall", version = "^0.0.14" }
|
||||
krata-xencall = { path = "../xencall", version = "^0.0.15" }
|
||||
memchr = { workspace = true }
|
||||
nix = { workspace = true }
|
||||
regex = { workspace = true }
|
||||
|
@ -14,8 +14,8 @@ cgroups-rs = { workspace = true }
|
||||
env_logger = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
ipnetwork = { workspace = true }
|
||||
krata = { path = "../krata", version = "^0.0.14" }
|
||||
krata-xenstore = { path = "../xen/xenstore", version = "^0.0.14" }
|
||||
krata = { path = "../krata", version = "^0.0.15" }
|
||||
krata-xenstore = { path = "../xen/xenstore", version = "^0.0.15" }
|
||||
libc = { workspace = true }
|
||||
log = { workspace = true }
|
||||
nix = { workspace = true, features = ["ioctl", "process", "fs"] }
|
||||
|
@ -16,6 +16,7 @@ use krata::idm::{
|
||||
};
|
||||
use log::debug;
|
||||
use nix::unistd::Pid;
|
||||
use tokio::sync::broadcast::Receiver;
|
||||
use tokio::{select, sync::broadcast};
|
||||
|
||||
pub struct ZoneBackground {
|
||||
@ -23,15 +24,18 @@ pub struct ZoneBackground {
|
||||
child: Pid,
|
||||
_cgroup: Cgroup,
|
||||
wait: ChildWait,
|
||||
child_receiver: Receiver<ChildEvent>,
|
||||
}
|
||||
|
||||
impl ZoneBackground {
|
||||
pub async fn new(idm: IdmInternalClient, cgroup: Cgroup, child: Pid) -> Result<ZoneBackground> {
|
||||
let (wait, child_receiver) = ChildWait::new()?;
|
||||
Ok(ZoneBackground {
|
||||
idm,
|
||||
child,
|
||||
_cgroup: cgroup,
|
||||
wait: ChildWait::new()?,
|
||||
wait,
|
||||
child_receiver,
|
||||
})
|
||||
}
|
||||
|
||||
@ -39,7 +43,6 @@ impl ZoneBackground {
|
||||
let mut event_subscription = self.idm.subscribe().await?;
|
||||
let mut requests_subscription = self.idm.requests().await?;
|
||||
let mut request_streams_subscription = self.idm.request_streams().await?;
|
||||
let mut wait_subscription = self.wait.subscribe().await?;
|
||||
loop {
|
||||
select! {
|
||||
x = event_subscription.recv() => match x {
|
||||
@ -86,7 +89,7 @@ impl ZoneBackground {
|
||||
}
|
||||
},
|
||||
|
||||
event = wait_subscription.recv() => match event {
|
||||
event = self.child_receiver.recv() => match event {
|
||||
Ok(event) => self.child_event(event).await?,
|
||||
Err(_) => {
|
||||
break;
|
||||
|
@ -1,3 +1,9 @@
|
||||
use anyhow::Result;
|
||||
use libc::{c_int, waitpid, WEXITSTATUS, WIFEXITED};
|
||||
use log::warn;
|
||||
use nix::unistd::Pid;
|
||||
use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use std::{
|
||||
ptr::addr_of_mut,
|
||||
sync::{
|
||||
@ -6,11 +12,6 @@ use std::{
|
||||
},
|
||||
thread::{self, JoinHandle},
|
||||
};
|
||||
|
||||
use anyhow::Result;
|
||||
use libc::{c_int, waitpid, WEXITSTATUS, WIFEXITED};
|
||||
use log::warn;
|
||||
use nix::unistd::Pid;
|
||||
use tokio::sync::broadcast::{channel, Receiver, Sender};
|
||||
|
||||
const CHILD_WAIT_QUEUE_LEN: usize = 10;
|
||||
@ -29,8 +30,8 @@ pub struct ChildWait {
|
||||
}
|
||||
|
||||
impl ChildWait {
|
||||
pub fn new() -> Result<ChildWait> {
|
||||
let (sender, _) = channel(CHILD_WAIT_QUEUE_LEN);
|
||||
pub fn new() -> Result<(ChildWait, Receiver<ChildEvent>)> {
|
||||
let (sender, receiver) = channel(CHILD_WAIT_QUEUE_LEN);
|
||||
let signal = Arc::new(AtomicBool::new(false));
|
||||
let mut processor = ChildWaitTask {
|
||||
sender: sender.clone(),
|
||||
@ -41,11 +42,14 @@ impl ChildWait {
|
||||
warn!("failed to process child updates: {}", error);
|
||||
}
|
||||
});
|
||||
Ok(ChildWait {
|
||||
sender,
|
||||
signal,
|
||||
_task: Arc::new(task),
|
||||
})
|
||||
Ok((
|
||||
ChildWait {
|
||||
sender,
|
||||
signal,
|
||||
_task: Arc::new(task),
|
||||
},
|
||||
receiver,
|
||||
))
|
||||
}
|
||||
|
||||
pub async fn subscribe(&self) -> Result<Receiver<ChildEvent>> {
|
||||
@ -63,7 +67,13 @@ impl ChildWaitTask {
|
||||
loop {
|
||||
let mut status: c_int = 0;
|
||||
let pid = unsafe { waitpid(-1, addr_of_mut!(status), 0) };
|
||||
|
||||
// pid being -1 indicates an error occurred, wait 100 microseconds to avoid
|
||||
// overloading the channel. Right now we don't consider any other errors
|
||||
// but that is fine for now, as waitpid shouldn't ever stop anyway.
|
||||
if pid == -1 {
|
||||
sleep(Duration::from_micros(100));
|
||||
continue;
|
||||
}
|
||||
if WIFEXITED(status) {
|
||||
let event = ChildEvent {
|
||||
pid: Pid::from_raw(pid),
|
||||
|
Reference in New Issue
Block a user