Skip to content

[make] Serialize AppleDocReader doc injection#25568

Open
dalexsoto wants to merge 3 commits into
mainfrom
dev/alex/appledocklock
Open

[make] Serialize AppleDocReader doc injection#25568
dalexsoto wants to merge 3 commits into
mainfrom
dev/alex/appledocklock

Conversation

@dalexsoto
Copy link
Copy Markdown
Member

Fixes: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=14220252&view=logs&j=7052fe35-1431-500d-b066-a8f68f3e4472&t=3e86fd51-d381-52a3-1170-668b62fca50b&s=1d91d519-4060-54d4-b74e-0ef61a7f9d43

GEN      Microsoft.iOS.xml
Microsoft.Data.Sqlite.SqliteException (0x80004005): SQLite Error 5: 'database is locked For more information on this error code see https://www.sqlite.org/rescode.html'.
   at Microsoft.Data.Sqlite.SqliteException.ThrowExceptionForRC(Int32 rc, sqlite3 db)
   at Microsoft.Data.Sqlite.SqliteConnection.BackupDatabase(SqliteConnection destination, String destinationName, String sourceName)
   at AppleDocReader.Database.MicrosoftDataSqlite.AdrMicrosoftDataSqliteConnection.BackupDatabase(AdrSqliteConnection destination, String destinationName, String sourceName, Int32 pages, Object ignored, Int32 retryMilliseconds) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrSqliteConnection.cs:line 160
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.ResolveChildren() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 604
   at AppleDocReader.Database.AdrDatabaseXcode14.Populate(Boolean populate) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 201
   at AppleDocReader.Database.AdrDatabaseXcode14.CreateFromXcode(String xcodePath, ValueTuple`2 version, String dbPath, HashSet`1 jsonSelectors) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrDatabaseXcode14.cs:line 125
   at AppleDocReader.Database.AdrFactory.GetDatabase(String xcodePath, String dbPath, HashSet`1 jsonSelectors) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Database/AdrFactory.cs:line 21
   at AppleDocReader.Commands.Inject.DocsCommand.InvokeInternal() in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Commands/Inject/DocsCommand.cs:line 36
   at AppleDocReader.Commands.AdrCommand.Invoke(IEnumerable`1 arguments) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Commands/AdrCommand.cs:line 61
   at Mono.Options.CommandSet.Run(IEnumerable`1 arguments)
   at AppleDocReader.MainClass.Main2(String[] args) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Main.cs:line 45
   at AppleDocReader.MainClass.Main(String[] args) in /Users/builder/azdo/_work/3/s/src/AppleDocReader/Main.cs:line 17
make[1]: *** [build/dotnet/macos/doc/Microsoft.macOS.xml] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [all-recurse] Error 1

AppleDocReader backs up a shared Xcode SQLite database while injecting docs into the generated platform XML files. When make builds the iOS, macOS, tvOS, and Mac Catalyst XML docs in parallel, multiple AppleDocReader processes can race on that database and fail with SQLite Error 5: database is locked.

Run AppleDocReader under a shared lockf lock so the rest of the build can remain parallel while the database access is serialized.

AppleDocReader backs up a shared Xcode SQLite database while injecting
docs into the generated platform XML files. When make builds the iOS,
macOS, tvOS, and Mac Catalyst XML docs in parallel, multiple
AppleDocReader processes can race on that database and fail with
SQLite Error 5: database is locked.

Run AppleDocReader under a shared lockf lock so the rest of the build can
remain parallel while the database access is serialized.
Copilot AI review requested due to automatic review settings May 28, 2026 15:59
@dalexsoto dalexsoto requested a review from rolfbjarne as a code owner May 28, 2026 15:59
Copy link
Copy Markdown
Contributor

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 serializes AppleDocReader documentation injection during parallel Make builds to avoid concurrent access to a shared Xcode SQLite database.

Changes:

  • Defines reusable APPLE_DOC_READER and lock-file variables.
  • Wraps AppleDocReader inject docs invocation with /usr/bin/lockf.
  • Adds a comment explaining why serialization is required.

@dalexsoto
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@dalexsoto dalexsoto enabled auto-merge (squash) May 29, 2026 01:54
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

Copy link
Copy Markdown
Member

@rolfbjarne rolfbjarne left a comment

Choose a reason for hiding this comment

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

I wonder if we could use a different database for each platform? In any case, let's try this first and see how it goes.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

🔥 [CI Build #beb9751] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 2 tests failed, 191 tests passed.

Failures

❌ monotouch tests (iOS) [attempt 9]

2 tests failed, 18 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Release (NativeAOT, ARM64): TimedOut
  • monotouch-test/iOS - simulator/Release (NativeAOT, .NET 11 defaults): TimedOut

Html Report (VSDrops) Download

Successes

✅ cecil: All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (iOS): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. [attempt 3] Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker (iOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 11 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 23 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ monotouch (macOS): All 23 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. (⚠️ Html Report Publish failed ⚠️) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. (⚠️ Html Report Publish failed ⚠️) Download

macOS tests

✅ Tests on macOS Monterey (12): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Ventura (13): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

Linux build succeeded

Pipeline on Agent
Hash: beb975133431e9bcd0c06fe88bf8006884a64ad1 [PR build]

@dalexsoto
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #f9da8ad] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: f9da8ada083f958b5d6bea3dc545bf680376a6c3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: f9da8ada083f958b5d6bea3dc545bf680376a6c3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #f9da8ad] Build passed (Build packages) ✅

Pipeline on Agent
Hash: f9da8ada083f958b5d6bea3dc545bf680376a6c3 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Copy Markdown
Collaborator

✅ [PR Build #f9da8ad] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: f9da8ada083f958b5d6bea3dc545bf680376a6c3 [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants