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

[SR-12825] ManifestLoader.getEngine() occasionally fails when called from libSwiftPM #4547

Open
abertelrud opened this issue May 16, 2020 · 0 comments
Assignees
Labels

Comments

@abertelrud
Copy link
Contributor

Previous ID SR-12825
Radar None
Original Reporter @abertelrud
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee @abertelrud
Priority Medium

md5: e4f09ac5cf88d3e61e12aac86c1affa9

Issue Description:

On rare occasions, using when loading a package graph for the first time using libSwftPM on macOS will result in the following error:

error: accessing build database "/Users/<redacted>/SourcePackages/manifest.db": database is locked; Possibly there are two concurrent builds running in the same filesystem location.

This seems to be coming from lldb when opening the SQLite build dependencies database for manifests, under the getEngine() function in ManifestLoader.

Retrying the operation usually works. The client is careful to serialize its use of libSwiftPM, and so this is thought to be something transient with the file system rather than two actually concurrent builds.

Here is the part of the backtrace that pertains to libSwiftPM, with loadJSONString() calling down to getEngine():

frame #&#8203;21: 0x00000001b3cb8954 libSwiftPM.dylib`ManifestLoader.loadJSONString(inputPath=TSCBasic.AbsolutePath @ 0x00007000078ea300, toolsVersion=PackageModel.ToolsVersion @ 0x00007000078eb2f8, packageIdentity="diceui", fs=nil, diagnostics=0x00006000027ddf80, self=0x00006000030a4ab0) at ManifestLoader.swift:472:30

frame #&#8203;22: 0x00000001b3cb5821 libSwiftPM.dylib`ManifestLoader.loadFile(inputPath=TSCBasic.AbsolutePath @ 0x00007000078eaae0, baseURL="ssh://<redacted>/diceui.git", version=nil, toolsVersion=PackageModel.ToolsVersion @ 0x00007000078eb2f8, packageKind=remote, fileSystem=nil, diagnostics=0x00006000027ddf80, self=0x00006000030a4ab0) at ManifestLoader.swift:238:30

frame #&#8203;23: 0x00000001b3cb518a libSwiftPM.dylib`ManifestLoader.load(path=TSCBasic.AbsolutePath @ 0x00007000078eae78, baseURL="ssh://<redacted>/diceui.git", version=nil, toolsVersion=PackageModel.ToolsVersion @ 0x00007000078eb2f8, packageKind=remote, fileSystem=nil, diagnostics=0x00006000027ddf80, self=0x00006000030a4ab0) at ManifestLoader.swift:198:20

frame #&#8203;24: 0x00000001b3cc92cd libSwiftPM.dylib`protocol witness for ManifestLoaderProtocol.load(packagePath:baseURL:version:toolsVersion:packageKind:fileSystem:diagnostics🙂 in conformance ManifestLoader at <compiler-generated>:0

frame #&#8203;25: 0x00000001b3cb3a25 libSwiftPM.dylib`ManifestLoaderProtocol.load(path=TSCBasic.AbsolutePath @ 0x00007000078eb010, baseURL="ssh://<redacted>/diceui.git", version=nil, toolsVersion=PackageModel.ToolsVersion @ 0x00007000078eb2f8, packageKind=remote, fileSystem=nil, diagnostics=0x00006000027ddf80, self=0x00006000030a4ab0) at ManifestLoader.swift:101:20

frame #&#8203;26: 0x00000001b3f2b41d libSwiftPM.dylib`closure #&#8203;1 in closure #&#8203;1 in Workspace.loadManifest(self=0x00000001a956d510, packagePath=TSCBasic.AbsolutePath @ 0x00007000078eb2e0, url="ssh://<redacted>/diceui.git", version=nil, packageKind=remote, diagnostics=0x00006000027ddf80) at Workspace.swift:1231:43

frame #&#8203;27: 0x00000001b3f442c9 libSwiftPM.dylib`partial apply for closure #&#8203;1 in closure #&#8203;1 in Workspace.loadManifest(packagePath:url:version:packageKind:diagnostics🙂 at <compiler-generated>:0

frame #&#8203;28: 0x00000001b3f2b5e3 libSwiftPM.dylib`thunk for @callee_guaranteed () -> (@owned Manifest, @error @owned Error) at <compiler-generated>:0

frame #&#8203;29: 0x00000001b3f442f4 libSwiftPM.dylib`partial apply for thunk for @callee_guaranteed () -> (@owned Manifest, @error @owned Error) at <compiler-generated>:0

frame #&#8203;30: 0x00000001b3e92b8a libSwiftPM.dylib`DiagnosticsEngine.wrap<T>(closure=0x00000001b3f442e0 libSwiftPM.dylib`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed () -> (@owned PackageModel.Manifest, @error @owned Swift.Error) to @escaping @callee_guaranteed () -> (@out PackageModel.Manifest, @error @owned Swift.Error) at <compiler-generated>, self=0x00006000027ddf80) at Diagnostics.swift:104:24

frame #&#8203;31: 0x00000001b3f2af48 libSwiftPM.dylib`closure #&#8203;1 in Workspace.loadManifest(diagnostics=0x00006000027ddf80, self=0x00000001a956d510, packagePath=TSCBasic.AbsolutePath @ 0x00007000078eb670, url="ssh://<redacted>/diceui.git", version=nil, packageKind=remote) at Workspace.swift:1220:32

frame #&#8203;32: 0x00000001b3f44263 libSwiftPM.dylib`partial apply for closure #&#8203;1 in Workspace.loadManifest(packagePath:url:version:packageKind:diagnostics🙂 at <compiler-generated>:0

frame #&#8203;33: 0x00000001b3f2b640 libSwiftPM.dylib`thunk for @callee_guaranteed (@guaranteed DiagnosticsEngine) -> (@owned Manifest?) at <compiler-generated>:0

frame #&#8203;34: 0x00000001b3f44281 libSwiftPM.dylib`partial apply for thunk for @callee_guaranteed (@guaranteed DiagnosticsEngine) -> (@owned Manifest?) at <compiler-generated>:0

frame #&#8203;35: 0x00000001b3e92a1b libSwiftPM.dylib`DiagnosticsEngine.with<T>(location=TSCUtility.PackageLocation.Local @ 0x00006000012f3ee0, closure=0x00000001b3f44270 libSwiftPM.dylib`partial apply forwarder for reabstraction thunk helper from @callee_guaranteed (@guaranteed TSCBasic.DiagnosticsEngine) -> (@owned Swift.Optional<PackageModel.Manifest>) to @escaping @callee_guaranteed (@guaranteed TSCBasic.DiagnosticsEngine) -> (@out Swift.Optional<PackageModel.Manifest>) at <compiler-generated>, self=0x000060000280cea0) at Diagnostics.swift:92:16

frame #&#8203;36: 0x00000001b3f252c7 libSwiftPM.dylib`Workspace.loadManifest(packagePath=TSCBasic.AbsolutePath @ 0x00007000078eb9c0, url="ssh://<redacted>/diceui.git", version=nil, packageKind=remote, diagnostics=0x000060000280cea0, self=0x00000001a956d510) at Workspace.swift:1219:28

frame #&#8203;37: 0x00000001b3f29ec6 libSwiftPM.dylib`Workspace.loadManifest(packageURL="ssh://<redacted>/diceui.git", diagnostics=0x000060000280cea0, self=0x00000001a956d510) at Workspace.swift:1200:16

frame #&#8203;38: 0x00000001b3f298b6 libSwiftPM.dylib`closure #&#8203;2 in Workspace.loadDependencyManifests($0=PackageGraph.PackageGraphRoot.PackageDependency @ 0x00007000078ebde0, self=0x00000001a956d510, diagnostics=0x000060000280cea0) at Workspace.swift:1153:20

frame #&#8203;39: 0x00000001b3c18a42 libSwiftPM.dylib`thunk for @callee_guaranteed (@guaranteed PackageGraphRoot.PackageDependency) -> (@owned Manifest?, @error @owned Error) at <compiler-generated>:0

frame #&#8203;40: 0x00000001b3f3d424 libSwiftPM.dylib`partial apply for thunk for @callee_guaranteed (@guaranteed PackageGraphRoot.PackageDependency) -> (@owned Manifest?, @error @owned Error) at <compiler-generated>:0

frame #&#8203;41: 0x00007fff63f6c259 libswiftCore.dylib`(extension in Swift):Swift.Sequence.compactMap<A>((A.Element) throws -> Swift.Optional<A1>) throws -> Swift.Array<A1> + 761

frame #&#8203;42: 0x00000001b3f19571 libSwiftPM.dylib`Workspace.loadDependencyManifests(root=PackageGraph.PackageGraphRoot @ 0x00007000078ec710, diagnostics=0x000060000280cea0, self=0x00000001a956d510) at Workspace.swift:1151:69

frame #&#8203;43: 0x00000001b3f14313 libSwiftPM.dylib`Workspace._resolve(root=PackageGraph.PackageGraphRootInput @ 0x00007000078ece40, forceResolution=false, extraConstraints=0 values, diagnostics=0x000060000280cea0, retryOnPackagePathMismatch=true, self=0x00000001a956d510) at Workspace.swift:1569:32

frame #&#8203;44: 0x00000001b3f22847 libSwiftPM.dylib`Workspace.loadPackageGraph(root=PackageGraph.PackageGraphRootInput @ 0x00007000078ed600, createMultipleTestProducts=true, createREPLProduct=false, forceResolvedVersions=false, diagnostics=0x000060000280cea0, xcTestMinimumDeploymentTargets=nil, self=0x00000001a956d510) at Workspace.swift:742:30

(the part under frame #21 here is in temporary debug logging code that wouldn't be part of the normal code path)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants