arijeetmukherjee3108-droid opened a new pull request, #41901:
URL: https://github.com/apache/beam/pull/41901

   Fixes #41900
   
   Right now, when `ModelManager.should_spawn_model()` frees up memory using 
`_evict_to_make_space()` it returns True without updating 
`_pending_reservations`, `_total_active_jobs` or `_active_counts[tag]`.
   
   This breaks the counters:
   - `_total_active_jobs` stays 0 while the new model is actually running, so 
an unknown model can enter isolation mode and delete it mid-inference.
   - When `release_model()` runs later, `_total_active_jobs` goes negative.
   - `_spawn_new_model()` still subtracts `est_cost` from 
`_pending_reservations` (messing up other concurrent loads) and drops 
`_active_counts[tag]` below 0 if the load fails.
   
   ### Changes
   - Update `_pending_reservations`, `_total_active_jobs` and 
`_active_counts[tag]` in `should_spawn_model()` even when space is freed via 
eviction.
   - Added 3 unit tests in 
`sdks/python/apache_beam/ml/inference/model_manager_test.py`:
     - `test_eviction_spawn_updates_active_accounting`
     - `test_eviction_spawn_load_failure_preserves_accounting`
     - `test_eviction_spawn_protected_from_isolation_flush`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to