From 89ceba9674f431dd23476eb8b2ec69c345c51ef8 Mon Sep 17 00:00:00 2001 From: bunnie Date: Sun, 17 Apr 2022 18:49:27 +0800 Subject: [PATCH] tweak some parameters and debug infos total threads in the net crate are around 10 right now, 32 max, so increasing the sleeping thread limit to 16, since every now and then we get exhaustion notes. --- services/net/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/services/net/src/main.rs b/services/net/src/main.rs index 0a128c84d..23f111cd6 100644 --- a/services/net/src/main.rs +++ b/services/net/src/main.rs @@ -40,6 +40,7 @@ use std::sync::Arc; use std::thread; const PING_DEFAULT_TIMEOUT_MS: u32 = 10_000; +const MAX_DELAY_THREADS: u32 = 16; // limit the number of concurrent delay threads. Typically we have 1-2 running at any time, but DoS conditions could lead to many more. fn set_ipv4_addr(iface: &mut Interface<'_, DeviceT>, cidr: Ipv4Cidr) where @@ -146,7 +147,6 @@ fn xmain() -> ! { com_int_list.clear(); com.ints_get_active(&mut com_int_list).ok(); log::debug!("COM pending interrupts after enabling: {:?}", com_int_list); - const MAX_DELAY_THREADS: u32 = 10; // limit the number of concurrent delay threads. Typically we have 1-2 running at any time, but DoS conditions could lead to many more. let delay_threads = Arc::new(AtomicU32::new(0)); let mut net_config: Option = None; @@ -486,6 +486,7 @@ fn xmain() -> ! { } Some(Opcode::StdTcpTx) => { + log::debug!("StdTcpTx"); let pid = msg.sender.pid(); std_tcp_tx( msg, @@ -504,6 +505,7 @@ fn xmain() -> ! { } Some(Opcode::StdTcpPeek) => { + log::debug!("StdTcpPeek"); let pid = msg.sender.pid(); std_tcp_peek(msg, &mut sockets, process_sockets.entry(pid).or_default()); xous::try_send_message( @@ -516,6 +518,7 @@ fn xmain() -> ! { } Some(Opcode::StdTcpRx) => { + log::debug!("StdTcpRx"); let pid = msg.sender.pid(); std_tcp_rx( msg, @@ -534,6 +537,7 @@ fn xmain() -> ! { } Some(Opcode::StdTcpClose) => { + log::debug!("StdTcpClose"); let pid = msg.sender.pid(); let connection_idx = msg.body.id() >> 16; let handle = if let Some(connection) = process_sockets @@ -561,6 +565,7 @@ fn xmain() -> ! { } Some(Opcode::StdTcpStreamShutdown) => { + log::debug!("StdTcpStreamShutdown"); // Only work with blockingscalar messages if !msg.body.is_blocking() || msg.body.has_memory() { respond_with_error(msg, NetError::LibraryError);