Skip to content

[DO NOT MERGE] Bound and report implicit module lock waits in tests - #2770

Draft
rintaro wants to merge 1 commit into
swiftlang:mainfrom
rintaro:fix-index-timeout-test-flakiness
Draft

rintaro wants to merge 1 commit into
swiftlang:mainfrom
rintaro:fix-index-timeout-test-flakiness

Conversation

@rintaro

@rintaro rintaro commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Investigating #2766

All tests share one module cache, so a test can wait on a module lock
that another test holds. Cancelling an index or preparation task kills
the compiler, and TaskScheduler.shutDown cancels every in-flight task
when a server shuts down, so tests routinely kill compilers that may
hold a lock. LockFileManager.processStillExecuting only detects a
dead lock owner on Unix, so on other platforms the waiter blocks for
the full -fimplicit-modules-lock-timeout, which defaults to 90
seconds, before clearing the lock and building the module itself. That
exceeds what an index task can absorb within its own timeout, and the
resulting failure looks like slow indexing rather than lock contention.

Lower the wait to 30 seconds so that it cannot consume the index store
timeout, and pass -Rmodule-build so that remark_module_lock_timeout
identifies the module whose lock was contended.

Whether lock contention actually causes the observed stalls is not
established; the remark is what would confirm or rule it out.

@rintaro
rintaro marked this pull request as draft September 19, 2026 15:53
@rintaro

rintaro commented Sep 19, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test

@rintaro

rintaro commented Sep 19, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

1 similar comment
@rintaro

rintaro commented Sep 19, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

All tests share one module cache, so a test can wait on a module lock
that another test holds. Cancelling an index or preparation task kills
the compiler, and `TaskScheduler.shutDown` cancels every in-flight task
when a server shuts down, so tests routinely kill compilers that may
hold a lock. `LockFileManager.processStillExecuting` only detects a
dead lock owner on Unix, so on other platforms the waiter blocks for
the full lock timeout before clearing the lock and building the module
itself, which can exceed what an index task absorbs within its own
timeout.

Report module builds with `-Rmodule-build` and lock acquisitions with
`-Rmodule-lock`, which is a separate diagnostic group, so that the log
shows every lock event rather than only a timeout. Lower the wait to 10
seconds so that contention shorter than the 90 second default is
reported instead of resolving silently.

The shorter wait makes clang clear a lock that a live owner still
holds, so some duplicate module builds are expected. That is acceptable
for reproducing the stalls and is why this is not intended to be
merged.
@rintaro
rintaro force-pushed the fix-index-timeout-test-flakiness branch from 2d3d1f1 to d5ba1c3 Compare September 20, 2026 04:19
@rintaro

rintaro commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

13 similar comments
@rintaro

rintaro commented Sep 20, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 24, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 28, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Oct 1, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

@rintaro

rintaro commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

@swift-ci Please test Windows

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.

1 participant