He-Pin opened a new issue, #3253:
URL: https://github.com/apache/pekko/issues/3253

   ### Motivation
   
   Sending `AdjustPoolSize` to a pool router can grow or shrink the pool beyond 
configured limits (`nr-of-instances`, resizer `lowerBound`/`upperBound`). The 
handler directly creates or removes routees without any bounds checking.
   
   ### Current Behavior
   
   `RoutedActorCell.scala:205-213`:
   
   ```scala
   case AdjustPoolSize(change: Int) =>
     if (change > 0) {
       val newRoutees = Vector.fill(change)(pool.newRoutee(cell.routeeProps, 
context))
       cell.addRoutees(newRoutees)
     } else if (change < 0) {
       val currentRoutees = cell.router.routees
       val abandon = currentRoutees.drop(currentRoutees.length + change)
       cell.removeRoutees(abandon, stopChild = true)
     }
   ```
   
   - No check against `pool.nrOfInstances(system)` (initial pool size)
   - No check against resizer `lowerBound` or `upperBound`
   - `pool.newRoutee()` is just a factory — creates routee with correct 
dispatcher but no bounds check
   
   ### Resizer Bounds Bypassed
   
   `DefaultResizer.capacity()` (`Resizer.scala:178-187`) does enforce bounds, 
but it's only called from `ResizablePoolCell.resize()` — NOT from the 
`AdjustPoolSize` handler. Even `ResizablePoolActor` delegates `AdjustPoolSize` 
to `super.receive` (the unbounded handler).
   
   ### Test Confirms Unbounded Behavior
   
   `RoundRobinSpec.scala:117-120` shows `AdjustPoolSize(+4)` growing a pool 
from 3 to 7 (beyond configured size), with no bounds test asserting this is 
correct.
   
   ### Expected Behavior
   
   `AdjustPoolSize` should respect pool configuration bounds. If a resizer is 
configured, the handler should delegate to the resizer's capacity logic. If no 
resizer is configured, the handler should at minimum not shrink below 1 or grow 
beyond a reasonable limit.
   
   ### Environment
   
   - Pekko Actor (any version)
   - `RoutedActorCell.scala:205-213`
   
   ### References
   
   None


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to