fix live-build resolv.conf (#3035)

* fix live-build resolv.conf

* improved debuggability
This commit is contained in:
Aiden McClelland
2025-09-24 22:44:25 -06:00
committed by GitHub
parent 6f1900f3bb
commit 5aa9c045e1
18 changed files with 69 additions and 31 deletions

View File

@@ -48,13 +48,14 @@ cli-registry = []
cli-startd = []
cli-tunnel = []
default = ["cli", "startd", "registry", "cli-container", "tunnel"]
dev = []
dev = ["backtrace-on-stack-overflow"]
docker = []
registry = []
startd = ["mail-send"]
test = []
tunnel = []
unstable = ["console-subscriber", "tokio/tracing"]
console = ["console-subscriber", "tokio/tracing"]
unstable = ["backtrace-on-stack-overflow"]
[dependencies]
arti-client = { version = "0.33", features = [
@@ -82,6 +83,7 @@ async-trait = "0.1.74"
axum = { version = "0.8.4", features = ["ws"] }
barrage = "0.2.3"
backhand = "0.21.0"
backtrace-on-stack-overflow = { version = "0.3.0", optional = true }
base32 = "0.5.0"
base64 = "0.22.1"
base64ct = "1.6.0"

View File

@@ -132,8 +132,6 @@ async fn inner_main(
.await?;
rpc_ctx.shutdown().await?;
tracing::info!("RPC Context is dropped");
Ok(shutdown)
}

View File

@@ -76,6 +76,11 @@ pub struct RpcContextSeed {
pub start_time: Instant,
pub crons: SyncMutex<BTreeMap<Guid, NonDetachingJoinHandle<()>>>,
}
impl Drop for RpcContextSeed {
fn drop(&mut self) {
tracing::info!("RpcContext is dropped");
}
}
pub struct Hardware {
pub devices: Vec<LshwDevice>,
@@ -269,7 +274,7 @@ impl RpcContext {
self.crons.mutate(|c| std::mem::take(c));
self.services.shutdown_all().await?;
self.is_closed.store(true, Ordering::SeqCst);
tracing::info!("RPC Context is shutdown");
tracing::info!("RpcContext is shutdown");
Ok(())
}

View File

@@ -1,3 +1,7 @@
fn main() {
#[cfg(feature = "backtrace-on-stack-overflow")]
unsafe {
backtrace_on_stack_overflow::enable()
};
startos::bins::startbox()
}

View File

@@ -15,12 +15,12 @@ use futures::future::BoxFuture;
use futures::stream::FusedStream;
use futures::{FutureExt, SinkExt, StreamExt, TryStreamExt};
use helpers::NonDetachingJoinHandle;
use imbl_value::{InternedString, json};
use imbl_value::{json, InternedString};
use itertools::Itertools;
use models::{ActionId, HostId, ImageId, PackageId};
use nix::sys::signal::Signal;
use persistent_container::{PersistentContainer, Subcontainer};
use rpc_toolkit::{CallRemoteHandler, Empty, HandlerArgs, HandlerFor, from_fn_async};
use rpc_toolkit::{from_fn_async, CallRemoteHandler, Empty, HandlerArgs, HandlerFor};
use serde::{Deserialize, Serialize};
use service_actor::ServiceActor;
use start_stop::StartStop;
@@ -47,11 +47,11 @@ use crate::service::action::update_tasks;
use crate::service::rpc::{ExitParams, InitKind};
use crate::service::service_map::InstallProgressHandles;
use crate::service::uninstall::cleanup;
use crate::util::Never;
use crate::util::actor::concurrent::ConcurrentActor;
use crate::util::io::{AsyncReadStream, TermSize, create_file, delete_file};
use crate::util::io::{create_file, delete_file, AsyncReadStream, TermSize};
use crate::util::net::WebSocketExt;
use crate::util::serde::Pem;
use crate::util::Never;
use crate::volume::data_dir;
use crate::{CAP_1_KiB, DATA_DIR};

View File

@@ -2,7 +2,7 @@ use std::net::Ipv4Addr;
use clap::Parser;
use ipnet::Ipv4Net;
use rpc_toolkit::{Context, Empty, HandlerExt, ParentHandler, from_fn_async};
use rpc_toolkit::{from_fn_async, Context, Empty, HandlerExt, ParentHandler};
use serde::{Deserialize, Serialize};
use crate::context::CliContext;
@@ -22,7 +22,7 @@ pub fn tunnel_api<C: Context>() -> ParentHandler<C> {
subnet_api::<C>().with_about("Add, remove, or modify subnets"),
)
// .subcommand(
// "forward",
// "port-forward",
// ParentHandler::<C>::new()
// .subcommand(
// "add",
@@ -77,19 +77,19 @@ pub fn subnet_api<C: Context>() -> ParentHandler<C, SubnetParams> {
// .with_call_remote::<CliContext>(),
// )
// .subcommand(
// "add-client",
// from_fn_async(add_client)
// "add-device",
// from_fn_async(add_device)
// .with_metadata("sync_db", Value::Bool(true))
// .no_display()
// .with_about("Add a client to a subnet")
// .with_about("Add a device to a subnet")
// .with_call_remote::<CliContext>(),
// )
// .subcommand(
// "remove-client",
// from_fn_async(remove_client)
// "remove-device",
// from_fn_async(remove_device)
// .with_metadata("sync_db", Value::Bool(true))
// .no_display()
// .with_about("Remove a client from a subnet")
// .with_about("Remove a device from a subnet")
// .with_call_remote::<CliContext>(),
// )
}

View File

@@ -912,7 +912,7 @@ impl AsRef<Path> for TmpDir {
}
impl Drop for TmpDir {
fn drop(&mut self) {
if self.path.exists() {
if self.path != PathBuf::new() && self.path.exists() {
let path = std::mem::take(&mut self.path);
tokio::spawn(async move {
tokio::fs::remove_dir_all(&path).await.log_err();

View File

@@ -59,7 +59,7 @@ impl StartOSLogger {
fn base_subscriber(logfile: LogFile) -> impl Subscriber {
use tracing_error::ErrorLayer;
use tracing_subscriber::prelude::*;
use tracing_subscriber::{EnvFilter, fmt};
use tracing_subscriber::{fmt, EnvFilter};
let filter_layer = || {
EnvFilter::builder()
@@ -80,10 +80,8 @@ impl StartOSLogger {
let sub = tracing_subscriber::registry();
#[cfg(feature = "unstable")]
#[cfg(feature = "console-subscriber")]
let sub = sub.with(console_subscriber::spawn());
#[cfg(not(feature = "unstable"))]
let sub = sub.with(filter_layer());
let sub = sub.with(fmt_layer).with(ErrorLayer::default());