Fixes#20049
When KV cache allocation fails, the server would retry indefinitely if idle slots were cleared but space was still insufficient due to fragmentation. This adds a retry counter (max 10 attempts) and adaptively reduces batch size to prevent infinite loops while maintaining graceful degradation under memory pressure.