Skip to content

enhance stable#432

Merged
loongs-zhang merged 3 commits intoacl-dev:masterfrom
loongs-zhang:temp
Apr 1, 2026
Merged

enhance stable#432
loongs-zhang merged 3 commits intoacl-dev:masterfrom
loongs-zhang:temp

Conversation

@loongs-zhang
Copy link
Copy Markdown
Member

// Describe your PR here; eg. Fixes #issueNo

Make sure that:

  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves stability across platforms by fixing type mismatches in Windows operator tests and making OrderedLocalQueue::is_empty() resilient to a stale-high len counter caused by cross-thread stealing.

Changes:

  • Update Windows operator test token handling to cast between usize and u64 where required by the IOCP operator API.
  • Change OrderedLocalQueue::is_empty() to verify emptiness by scanning underlying per-priority Workers when len() indicates non-empty.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/src/net/operator/windows/tests.rs Align token types with the Windows operator’s u64 user-data/token interface via explicit casts.
core/src/common/ordered_work_steal.rs Make local-queue emptiness checks robust to stale-high counters by scanning workers when needed.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/common/ordered_work_steal.rs Outdated
Comment thread core/src/common/ordered_work_steal.rs Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread core/src/common/ordered_work_steal.rs
Comment thread core/src/common/ordered_work_steal.rs Outdated
Comment on lines 298 to 306
//把本地队列的一半放到全局队列
let count = self.len() / 2;
let count = self.local_len() / 2;
for _ in 0..count {
for entry in self.queue.iter().rev() {
if let Some(item) = entry.value().pop() {
self.shared.push_with_priority(*entry.key(), item);
}
}
}
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

push_to_global subtracts count from the local counter, but the nested loops can pop more (or fewer) than count items because each outer iteration can pop up to one item per priority entry. This will desynchronize local_len() from the actual number of local items. Track the exact number of items actually moved to the shared queue and adjust the local counter by that value (or recompute local occupancy after the transfer).

Copilot uses AI. Check for mistakes.
Comment on lines +418 to +424
// refresh local len
self.len.store(
self.local_len().saturating_add(
into_queue.capacity() - into_queue.spare_capacity(),
),
Ordering::Release,
);
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

After a successful sibling steal, the “refresh local len” logic adds into_queue.capacity() - into_queue.spare_capacity() to the existing local_len(). This value is the total current size of into_queue, not the number of newly stolen items, so it can overcount (especially when the priority bucket already had items). Consider capturing the stolen count inside the steal closure or recomputing the full local occupancy across all buckets and storing that.

Copilot uses AI. Check for mistakes.
Comment thread core/src/common/ordered_work_steal.rs
Comment thread core/src/net/operator/windows/tests.rs
Comment thread core/src/net/operator/windows/tests.rs
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 1, 2026

Codecov Report

❌ Patch coverage is 63.63636% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 75.45%. Comparing base (5fabaa8) to head (434e385).

Files with missing lines Patch % Lines
core/src/common/ordered_work_steal.rs 63.63% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #432      +/-   ##
==========================================
- Coverage   75.46%   75.45%   -0.01%     
==========================================
  Files          44       44              
  Lines        4675     4698      +23     
==========================================
+ Hits         3528     3545      +17     
- Misses       1147     1153       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@loongs-zhang loongs-zhang merged commit a60d251 into acl-dev:master Apr 1, 2026
1 of 27 checks passed
Copilot AI added a commit that referenced this pull request Apr 2, 2026
Add CoroutinePool::is_local_empty() method and use it in event loop
thread exit condition and do_stop_sync() shutdown check. After PR #432,
is_empty() checks all queues globally (including siblings), causing the
event loop to block until all sibling queues drain. Using is_local_empty()
restores local-only exit semantics so each event loop exits when its own
work is done.

Agent-Logs-Url: https://github.com/acl-dev/open-coroutine/sessions/a25cbffc-7ce7-4db8-a618-776a75374e56

Co-authored-by: loongs-zhang <38336731+loongs-zhang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants