Skip to content

Conversation

@FranzBusch
Copy link
Member

Motivation

Swift 5.8 is including a change to how group.waitForAll() is working. It now properly waits for all tasks to finish even if one of the tasks throws. We have used group.waitForAll() in multiple places and need to change this code accordingly.

Modification

Switch code from group.waitForAll() to group.next().

Result

This fixes a few stuck tests that we have seen when running against development snapshots.

# Motivation
Swift 5.8 is including a change to how `group.waitForAll()` is working. It now properly waits for all tasks to finish even if one of the tasks throws. We have used `group.waitForAll()` in multiple places and need to change this code accordingly.

# Modification
Switch code from `group.waitForAll()` to `group.next()`.

# Result
This fixes a few stuck tests that we have seen when running against development snapshots.
@finagolfin
Copy link
Contributor

I can confirm this fixes all the test issues alluded to in #253 on Android AArch64. On linux x86_64, maybe it's because I'm running on a single-core VPS, but I still see issues. If you don't see any problems on a beefier linux box, probably unrelated and you can go ahead with this.

Copy link
Member

@phausler phausler left a comment

Choose a reason for hiding this comment

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

If we are sure that the isEmpty does not introduce races (which from our side doesn't seem to have any) this looks fine to me.

@phausler
Copy link
Member

@swift-ci test

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

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

This is LGTM and I clarified semantics of the waitForAll now in Swift itself: swiftlang/swift#63956

The implementation actually is pretty much the same in Swift, a loop over isEmpty so this will be ok -- it is not racy since only the parent task can be adding tasks 👍

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.

4 participants