Skip to content

Commit d8cae8a

Browse files
committed
fix(mcp): correct unix-only pgid lazy static
1 parent e36083a commit d8cae8a

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/mcp/process.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,6 @@ lazy_static::lazy_static! {
101101
static ref SERVER_REF_COUNTS: Arc<RwLock<HashMap<String, usize>>> =
102102
Arc::new(RwLock::new(HashMap::new()));
103103

104-
// Process group IDs for SIGKILL fallback when ServerProcess mutex is locked.
105-
// Stored OUTSIDE ServerProcess so we can kill processes even when busy.
106-
// Unix-only: used to send SIGKILL to -pgid when try_lock() fails.
107-
#[cfg(unix)]
108-
static ref SERVER_PGIDS: Arc<RwLock<HashMap<String, libc::pid_t>>> =
109-
Arc::new(RwLock::new(HashMap::new()));
110-
111104
/// Recent stderr lines per server — background reader threads push lines here
112105
/// so that initialization/runtime errors can be surfaced to the user.
113106
static ref SERVER_STDERR: Arc<RwLock<HashMap<String, StderrBuffer>>> =
@@ -118,6 +111,16 @@ lazy_static::lazy_static! {
118111
static ref SERVER_CAPABILITIES: Arc<RwLock<HashMap<String, rmcp::model::InitializeResult>>> =
119112
Arc::new(RwLock::new(HashMap::new()));
120113
}
114+
115+
// Process group IDs for SIGKILL fallback when ServerProcess mutex is locked.
116+
// Stored OUTSIDE ServerProcess so we can kill processes even when busy.
117+
// Unix-only: used to send SIGKILL to -pgid when try_lock() fails.
118+
#[cfg(unix)]
119+
lazy_static::lazy_static! {
120+
static ref SERVER_PGIDS: Arc<RwLock<HashMap<String, libc::pid_t>>> =
121+
Arc::new(RwLock::new(HashMap::new()));
122+
}
123+
121124
// Global notification sender — set by the session when WebSocket or JSONL output is active.
122125
// When set, MCP server notifications are forwarded as structured ServerMessage::McpNotification.
123126
// When not set, notifications are buffered and flushed when a sender is registered.

0 commit comments

Comments
 (0)