{"record":{"id":"4d40f62abb83bee6","repo":"rustdesk/rustdesk","slug":"maximum-number-of-terminal-services-reached","errorCode":null,"errorMessage":"Maximum number of terminal services ({}) reached","messagePattern":"Maximum number of terminal services \\((.+?)\\) reached","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/server/terminal_service.rs","lineNumber":171,"sourceCode":"    }\n    true\n}\n\npub fn is_service_specified_user(service_id: &str) -> Option<bool> {\n    get_service(service_id).map(|s| s.lock().unwrap().is_specified_user)\n}\n\n/// Get or create a persistent terminal service\nfn get_or_create_service(\n    service_id: String,\n    is_persistent: bool,\n    is_specified_user: bool,\n) -> Result<Arc<Mutex<PersistentTerminalService>>> {\n    let mut services = TERMINAL_SERVICES.lock().unwrap();\n\n    // Check service limit\n    if !services.contains_key(&service_id) && services.len() >= MAX_SERVICES {\n        return Err(anyhow!(\n            \"Maximum number of terminal services ({}) reached\",\n            MAX_SERVICES\n        ));\n    }\n\n    let service = services\n        .entry(service_id.clone())\n        .or_insert_with(|| {\n            log::info!(\n                \"Creating new terminal service: {} (persistent: {})\",\n                service_id,\n                is_persistent\n            );\n            Arc::new(Mutex::new(PersistentTerminalService::new(\n                service_id.clone(),\n                is_persistent,\n                is_specified_user,\n            )))","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/rustdesk/rustdesk/blob/91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540/src/server/terminal_service.rs#L153-L189","documentation":"get_or_create_service hit the MAX_SERVICES cap: a new terminal service id was requested while that many persistent services already exist. This is a resource-limit guard (prevents unbounded per-user service accumulation), not an OS failure; the limit value is included in the message.","triggerScenarios":"Thrown at src/server/terminal_service.rs:171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Close unused terminal sessions (they unregister their service) and retry","If more concurrent terminals are genuinely needed, raise MAX_SERVICES and rebuild","Check for leaked services: sessions stuck without proper Close/Closed handling keep slots occupied"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"91c9fccbb0f7bfe5f11644d5fbdec9b23fa10540","analyzedAt":"2026-09-10T19:53:44.083Z","contentChangedAt":"2026-09-10T19:53:44.083Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}