You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asyncband.apache.org by "tisonkun (via GitHub)" <gi...@apache.org> on 2026/08/31 14:58:04 UTC

[PR] fix: harden waiter callback safety for 0.7.0 [asyncband]

tisonkun opened a new pull request, #257:
URL: https://github.com/apache/asyncband/pull/257

   ## Summary
   
   - Clone semaphore and condvar wakers outside waiter locks, including replacement and cancellation cleanup.
   - Complete semaphore and condvar fan-out before resuming a panicking wake callback.
   - Keep oneshot waker ownership recoverable if replacement cloning panics.
   
   ## Design Notes
   
   This deliberately limits the 0.7.0 audit to deterministic callback-safety failures covered by regression tests. It does not add convenience APIs, speculative documentation, version metadata, or unrelated cleanup. Each behavior change is isolated in its own commit.
   
   ## Validation
   
   - `cargo x lint`
   - `cargo x check`
   - `cargo x test`
   - `RUSTUP_TOOLCHAIN=1.86.0 cargo x test --no-capture`
   - `cargo x miri`
   - `cargo x semver --release-version 0.7.0 --acknowledge-breaking-changes`
   - `cargo publish --package asyncband --locked --dry-run`
   


-- 
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: commits-unsubscribe@asyncband.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org


Re: [PR] refactor: simplify waiter registration for 0.7.0 [asyncband]

Posted by "tisonkun (via GitHub)" <gi...@apache.org>.
tisonkun merged PR #257:
URL: https://github.com/apache/asyncband/pull/257


-- 
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: commits-unsubscribe@asyncband.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org


Re: [PR] refactor: simplify waiter registration for 0.7.0 [asyncband]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #257:
URL: https://github.com/apache/asyncband/pull/257#discussion_r3896306850


##########
asyncband/src/internal/atomic_waker.rs:
##########
@@ -139,15 +135,9 @@ impl AtomicWaker {
             None => true,
         };
 
-        let mut clone_panic = None;
         let old_waker = if needs_replacement {
-            match catch_unwind(AssertUnwindSafe(|| waker.clone())) {
-                Ok(new_waker) => unsafe { (*self.waker.get()).replace(new_waker) },
-                Err(payload) => {
-                    clone_panic = Some(payload);
-                    None
-                }
-            }
+            // SAFETY: the caller owns the REGISTERING state and is the only slot accessor.
+            unsafe { (*self.waker.get()).replace(waker.clone()) }
         } else {

Review Comment:
   `waker.clone()` can panic (custom `RawWaker`), and in that case `register_locked` will unwind while the atomic state is still `REGISTERING`. If the panic is caught, subsequent `register`/`wake` calls can no longer make progress because the state never returns to `WAITING`. Consider using an RAII guard to restore `WAITING` on unwind (and optionally complete any recorded wake) while still letting the panic propagate.



-- 
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: commits-unsubscribe@asyncband.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@asyncband.apache.org
For additional commands, e-mail: commits-help@asyncband.apache.org