Skip to content

Commit c9ed8ca

Browse files
dschaefer2bripeticca
authored andcommitted
Revert "Retrieve resolved package versions in parallel" (swiftlang#8217)
Reverts swiftlang#8203 This is causing crashes in SwiftPM during the parallelized checkout. The checkouts update the workspace state and then save it. The workspace save data is not protected against multi-thread access while the save is walking the data which is causing the crash.
1 parent f6a3a0a commit c9ed8ca

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

Sources/Workspace/Workspace+Dependencies.swift

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -444,31 +444,26 @@ extension Workspace {
444444
}
445445

446446
// Retrieve the required resolved packages.
447-
await withThrowingTaskGroup(of: Void.self) { taskGroup in
448-
for resolvedPackage in requiredResolvedPackages {
449-
let observabilityScope = observabilityScope.makeChildScope(
450-
description: "retrieving resolved package versions for dependencies",
451-
metadata: resolvedPackage.packageRef.diagnosticsMetadata
452-
)
453-
taskGroup.addTask {
454-
await observabilityScope.trap {
455-
switch resolvedPackage.packageRef.kind {
456-
case .localSourceControl, .remoteSourceControl:
457-
_ = try await self.checkoutRepository(
458-
package: resolvedPackage.packageRef,
459-
at: resolvedPackage.state,
460-
observabilityScope: observabilityScope
461-
)
462-
case .registry:
463-
_ = try await self.downloadRegistryArchive(
464-
package: resolvedPackage.packageRef,
465-
at: resolvedPackage.state,
466-
observabilityScope: observabilityScope
467-
)
468-
default:
469-
throw InternalError("invalid resolved package type \(resolvedPackage.packageRef.kind)")
470-
}
471-
}
447+
for resolvedPackage in requiredResolvedPackages {
448+
await observabilityScope.makeChildScope(
449+
description: "retrieving resolved package versions for dependencies",
450+
metadata: resolvedPackage.packageRef.diagnosticsMetadata
451+
).trap {
452+
switch resolvedPackage.packageRef.kind {
453+
case .localSourceControl, .remoteSourceControl:
454+
_ = try await self.checkoutRepository(
455+
package: resolvedPackage.packageRef,
456+
at: resolvedPackage.state,
457+
observabilityScope: observabilityScope
458+
)
459+
case .registry:
460+
_ = try await self.downloadRegistryArchive(
461+
package: resolvedPackage.packageRef,
462+
at: resolvedPackage.state,
463+
observabilityScope: observabilityScope
464+
)
465+
default:
466+
throw InternalError("invalid resolved package type \(resolvedPackage.packageRef.kind)")
472467
}
473468
}
474469
}

0 commit comments

Comments
 (0)