[SIGNIFICANT] remove_service uses recursive async -- stack depth risk #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
remove_serviceinapi.rsrecursively calls itself withBox::pin(self.remove_service(dep_name)).awaitfor each dependent. In a deep dependency chain (A<-B<-C<-D<-...<-Z), this creates deep async recursion.While
Box::pinprevents stack overflow on the Rust call stack, each level still allocates a Box and a future. A chain of 100+ services could cause issues.Impact
Memory allocation per recursion level. In extreme cases, could hit allocation limits or cause latency spikes.
Files
crates/my_init_server/src/supervisor/api.rs--remove_servicerecursive callSuggested Fix
Each recursion level allocates a Box and future; in extreme dependency chains this could cause allocation pressure or latency spikes.