Skip to content

Preserve the deadline in IceGrid ServerEntry synchronization waits - #6641

Open
bernardnormier wants to merge 1 commit into
zeroc-ice:mainfrom
bernardnormier:icegrid-server-sync-wait-deadline
Open

Preserve the deadline in IceGrid ServerEntry synchronization waits#6641
bernardnormier wants to merge 1 commit into
zeroc-ice:mainfrom
bernardnormier:icegrid-server-sync-wait-deadline

Conversation

@bernardnormier

Copy link
Copy Markdown
Member

ServerEntry shares the Allocatable mutex and condition variable, so the condition variable is also notified by ordinary allocation state transitions. ServerEntry::waitImpl restarted a full wait_for(timeout) on every wake-up, so such notifications during a pending synchronization could extend the wait well past the requested timeout, delaying the SynchronizationException. It now waits on an absolute deadline with a predicate, so unrelated notifications can't extend the bound.

Addresses the deadline part of item 2 of #6626. The other part of item 2 (remote Glacier2 session-filter invocations while holding the shared mutex) is an instance of a broader pattern to address in 3.9.

🤖 Generated with Claude Code

ServerEntry shares the Allocatable mutex and condition variable, so the
condition variable is also notified by allocation state transitions.
waitImpl restarted a full wait_for(timeout) on every wake-up, so such
notifications during a pending synchronization could extend the wait well
past the requested timeout. Wait on an absolute deadline with a predicate
instead.

Addresses part of item 2 of zeroc-ice#6626.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes IceGrid synchronization waits so allocation notifications cannot extend their timeout.

Changes:

  • Uses a steady-clock deadline with a predicate.
  • Preserves zero and negative timeout semantics.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

_condVar.wait(lock);
}
}
_condVar.wait_until(lock, chrono::steady_clock::now() + timeout, [this] { return !_synchronizing; });
Comment on lines +710 to +712
if (timeout > 0s)
{
while (_synchronizing)
{
if (timeout > 0s)
{
if (_condVar.wait_for(lock, timeout) == cv_status::timeout)
{
break; // Timeout
}
}
else
{
_condVar.wait(lock);
}
}
_condVar.wait_until(lock, chrono::steady_clock::now() + timeout, [this] { return !_synchronizing; });

@InsertCreativityHere InsertCreativityHere left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants