Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[node-core-library] iterator weighting isn't fully respected by Async#forEachAsync #4688

Merged

Conversation

aramissennyeydd
Copy link
Contributor

Summary

Followup to #4672. This PR fixes 2 bugs that I found while trying to integrate this with our CI,

  1. operation weight isn't passed correctly to the execution record.
  2. operation weight wasn't being respected if operations were queued at the same time.

Before

Screenshot 2024-05-07 at 12 24 01 PM

After

(a,b,c all have operation weight 10)
Screenshot 2024-05-08 at 7 44 31 PM

Details

The existing AsyncQueueManager requires the forEachAsync implementation to be reentrant and to have multiple waiting iterators. Moving to a weighted operation model requires the forEachAsync to lock when pulling off an item from the iterator as we don't know the operation weight until after we pop the item. To correct this difference, I updated AsyncQueueManager to explicitly reassign operations when marking the operation as complete or after handling a remote executing operation.

This may affect performance, but the critical zone that is now being locked should not affect performance. As seen in the graphs above, this does change the REMOTE_EXECUTING behavior a bit.

How it was tested

I tested this using the cobuilds build-tests sandbox repo and a bunch of console logs. I changed the operation weights to equal the -p parameter which caused sequential timelines.

I would appreciate additional testing/validation to make sure I'm on the right track 🙏

Impacted documentation

@iclanton iclanton enabled auto-merge May 10, 2024 03:27
@iclanton iclanton merged commit b7704b4 into microsoft:main May 10, 2024
5 checks passed
@octogonz octogonz changed the title fix(node-core-library): iterator weighting isn't fully respected by Async#forEachAsync [node-core-library] iterator weighting isn't fully respected by Async#forEachAsync May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

None yet

2 participants