Skip to main content

MAX_PENDING_SESSIONS

Constant MAX_PENDING_SESSIONS 

Source
pub const MAX_PENDING_SESSIONS: usize = 1000;
Expand description

Maximum number of concurrent pending generation sessions (denial-of-service protection, CWE-400).

Sessions are only ever swept lazily (as a side effect of StateManager::store/ StateManager::take), so without a hard ceiling a caller who repeatedly calls introspect_server without ever following up with save_categorized_tools could grow this table without bound. This is a structural backstop against unbounded HashMap growth (and the iteration cost of sweeping it) independent of session size; MAX_TOTAL_PENDING_BYTES below is what actually bounds memory, since a session’s size can vary by orders of magnitude depending on the introspected server’s tool count.