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

   ## Summary
   
   `ClusterSingletonManager` releases its lease from two places. One converts a 
failed `Future` into `ReleaseLeaseFailure`; the other does not, so a failure 
there arrives as a `Status.Failure` that the state machine does not handle.
   
   ## Evidence
   
   
`cluster-tools/src/main/scala/org/apache/pekko/cluster/singleton/ClusterSingletonManager.scala:1227-1229`
 — the `AcquiringLease` path:
   
   ```scala
   pipe(l.release().map[Any](ReleaseLeaseResult(_)).recover {
     case t => ReleaseLeaseFailure(t)
   }).to(self))
   ```
   
   `:1239` — the `Oldest -> _` path:
   
   ```scala
   pipe(l.release().map(ReleaseLeaseResult(_))).to(self)
   ```
   
   Both message types are handled, at `:1189` and `:1194`:
   
   ```scala
   case Event(ReleaseLeaseFailure(t), _)       => ...
   case Event(ReleaseLeaseResult(released), _) => ...
   ```
   
   A `Status.Failure` produced by `:1239` matches neither.
   
   ## Impact
   
   Observability rather than correctness. The `Oldest -> _` transition has 
already completed and the release is fire-and-forget, so the state machine does 
not wedge. But when the lease backend is unavailable during a hand-over, no 
"failed to release lease" error is logged — which is exactly the situation 
where the diagnostic matters, because a lease that was never released can delay 
the next singleton activation on another node.
   
   Both message types extend `DeadLetterSuppression` (`:287`, `:289`), so the 
escaped failure is unlikely to surface as a dead-letter warning either.
   
   ## Suggested direction
   
   Mirror `:1227-1229` at `:1239`.
   
   ## Test
   
   
`cluster-tools/src/test/scala/org/apache/pekko/cluster/singleton/ClusterSingletonLeaseSpec.scala:220`
 already covers "release lease when leaving oldest", asserting 
`testLease.probe.expectMsg(ReleaseReq(leaseOwner))` at `:234`. 
`TestLease.release()` 
(`coordination/src/test/scala/org/apache/pekko/coordination/lease/TestLease.scala:101-104`)
 currently hardcodes `Future.successful(true)`; adding a `nextReleaseResult: 
AtomicReference[Future[Boolean]]` next to the existing `nextAcquireResult` 
(`:79`) would allow a case asserting that a failed release reaches the 
`ReleaseLeaseFailure` handler.
   


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