Skip to content

Fix cocoapods data race - #1070

Merged
ekharkunov merged 5 commits into
defold:devfrom
zotrix:fix-cocoapods-data-race
Sep 28, 2026
Merged

ekharkunov merged 5 commits into
defold:devfrom
zotrix:fix-cocoapods-data-race

Conversation

@zotrix

@zotrix zotrix commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Trying to fix #989
isolated-install copy pods to isolated dir before use.

 copy files using clonefile(2).  Note that if the source and target are on different filesystems, or the
           target filesystem does not support cloning, cp will fallback to using copyfile(2) instead to ensure the
           copy still succeeds.

merge-back merge changes back to home, to allow reuse later

2026-09-24 14:15:37.234  INFO [extender,6ab5064b8b57cfd288b857d4f4ee5814,4bb87513b53808de] 57970 --- [job1164653351431
4415319] c.d.e.s.cocoapods.CocoaPodsService       : Cloning pod cache from /cache/cocoapods-new2/93304e74-ec3e-40fd-875e-453310db8d2b to isolated dir /
var/folders/nh/h3z_g3qd75gd7nr325_3nz8h0000gs/T/job11646533514314415319/CocoaPodsService/pod_cache
2026-09-24 14:15:37.245  INFO [extender,6ab5064b8b57cfd288b857d4f4ee5814,4bb87513b53808de] 57970 --- [job1164653351431
4415319] c.d.e.s.cocoapods.CocoaPodsService       : Cloned pod cache into isolated dir /var/folders/nh/h3z_g3qd75gd7nr
325_3nz8h0000gs/T/job11646533514314415319/CocoaPodsService/pod_cache

@ekharkunov
ekharkunov self-requested a review September 24, 2026 12:04
zotrix and others added 2 commits September 25, 2026 18:40
generateHeaderMap() pointed public header entries at "<moduleName>/<filename>"
instead of the header's real directory. That only resolves when a directory
literally named after the module exists relative to clang's working
directory, which is true for CocoaPods' own Headers/Public symlink layout but
not for headers vendored inside an .xcframework (e.g. IronSourceAdQualitySDK).

Since clang treats a header map as an authoritative lookup table, a wrong
entry there causes the compiler to stop searching once it matches the
filename instead of falling through to the correct -I directory later in the
search path, producing a "file not found" error even though the header
exists on disk.

Also adds validateHeaderMapEntries(), which warns when a generated header map
entry doesn't resolve to a real file, to surface this failure mode
immediately instead of requiring fs_usage-level tracing to diagnose it.
- Restore ReentrantReadWriteLock: non-isolated install, repo update/add-cdn,
  rotation, cleanup and merge-back take the write lock; cloning the shared
  cache for an isolated install takes the read lock so clones run concurrently
- Snapshot the shared cache dir under the lock before cloning, skip merge-back
  if the cache was rotated during install, and don't fail the build on a
  merge-back error
- Replace 'cp -R -c' with FileCloneUtil.cloneTree (Files.copy with
  COPY_ATTRIBUTES uses clonefile(2) on macOS with JDK 21+); merge-back only
  adds new files and never overwrites the shared cache
- Enable isolated-install by default
@ekharkunov
ekharkunov merged commit fbc7469 into defold:dev Sep 28, 2026
4 of 5 checks passed
@ekharkunov

Copy link
Copy Markdown
Contributor

@zotrix Thanks for contribution!

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.

Build failed but restart solve issue

2 participants