File tree Expand file tree Collapse file tree
crates/rmcp/src/transport/streamable_http_server/session Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1069,19 +1069,30 @@ impl Worker for LocalSessionWorker {
10691069pub struct SessionConfig {
10701070 /// the capacity of the channel for the session. Default is 16.
10711071 pub channel_capacity : usize ,
1072- /// if set, the session will be closed after this duration of inactivity.
1072+ /// The session will be closed after this duration of inactivity.
1073+ ///
1074+ /// This serves as a safety net for cleaning up sessions whose HTTP
1075+ /// connections have silently dropped (e.g., due to an HTTP/2
1076+ /// `RST_STREAM`). Without a timeout, such sessions become zombies:
1077+ /// the session worker keeps running indefinitely because the session
1078+ /// handle's sender is still held in the session manager, preventing
1079+ /// the worker's event channel from closing.
1080+ ///
1081+ /// Defaults to 5 minutes. Set to `None` to disable (not recommended
1082+ /// for long-running servers behind proxies).
10731083 pub keep_alive : Option < Duration > ,
10741084}
10751085
10761086impl SessionConfig {
10771087 pub const DEFAULT_CHANNEL_CAPACITY : usize = 16 ;
1088+ pub const DEFAULT_KEEP_ALIVE : Duration = Duration :: from_secs ( 300 ) ;
10781089}
10791090
10801091impl Default for SessionConfig {
10811092 fn default ( ) -> Self {
10821093 Self {
10831094 channel_capacity : Self :: DEFAULT_CHANNEL_CAPACITY ,
1084- keep_alive : None ,
1095+ keep_alive : Some ( Self :: DEFAULT_KEEP_ALIVE ) ,
10851096 }
10861097 }
10871098}
You can’t perform that action at this time.
0 commit comments