Skip to content

[Concurrency] Further prevent crashes in legacy mode of isSameExecutor #73813

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

Merged
merged 8 commits into from
May 28, 2024

Conversation

ktoso
Copy link
Contributor

@ktoso ktoso commented May 22, 2024

This cleans up interactions with the "legacy mode" where we're not allowed to crash in the isCurrentExecutor impl.

Also cleans up interactions with the SWIFT_UNEXPECTED_EXECUTOR_LOG_LEVEL mode.

This PR also makes all tests to run in both the swift6 and legacy modes, so we have a better overview what's expected.

resolves rdar://128425368
resolves rdar://127400013
resolves rdar://128508780
resolves rdar://128508874

@ktoso ktoso changed the title [Concurrency] Fix missing return in legacy isSameExecutor mode detection [Concurrency] Further prevent crashes in legacy mode of isSameExecutor May 22, 2024
@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from 5837aa1 to e559620 Compare May 22, 2024 02:15
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

@swift-ci please smoke test

@ktoso ktoso requested a review from mikeash May 22, 2024 02:15
@ktoso ktoso added the concurrency Feature: umbrella label for concurrency language features label May 22, 2024
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

Repalces #73773

@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

This still isn't right I think... doing more investigating and adding more tests for various cases.

@ktoso ktoso requested a review from al45tair as a code owner May 22, 2024 09:00
@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from f32a1a2 to 4812a8c Compare May 22, 2024 09:06
@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from 4812a8c to efed449 Compare May 22, 2024 09:22
if (const char *modeStr = runtime::environment::concurrencyIsCurrentExecutorLegacyModeOverride()) {
if (strcmp(modeStr, "nocrash") == 0 || strcmp(modeStr, "legacy") == 0) {
useLegacyMode = true;
} else if (strcmp(modeStr, "crash") == 0 || strcmp(modeStr, "swift6") == 0) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to make it less confusing in our tests; this is not expected to be used by anyone tbh, but I keep the old mode names.

@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch 4 times, most recently from 26a4804 to 410aece Compare May 22, 2024 11:06
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

@swift-ci please smoke test

// RUN: %empty-directory(%t)
// RUN: %target-build-swift -Xfrontend -disable-availability-checking %import-libdispatch -parse-as-library %s -o %t/a.out
// RUN: %target-codesign %t/a.out
// RUN: %env-SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE=swift6 %target-run %t/a.out
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note that all the tests now have two SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE versions

@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from 410aece to bef90eb Compare May 22, 2024 14:15
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

@swift-ci please smoke test

#if !SWIFT_CONCURRENCY_EMBEDDED
swift::runtime::bincompat::
return swift::runtime::bincompat::
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this patch also includes this very important bit; previously this missing return would have rendered the bincompat detection useless.

@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch 2 times, most recently from 9bc4849 to f03c5f2 Compare May 22, 2024 14:21
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

@swift-ci please smoke test

@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from f03c5f2 to f15da4a Compare May 22, 2024 14:59
@ktoso
Copy link
Contributor Author

ktoso commented May 22, 2024

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 23, 2024

Final commit to fix a test on linux/windows, impl remained the same.

@ktoso
Copy link
Contributor Author

ktoso commented May 23, 2024

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 24, 2024

Ofc whack-a-mole with tests in CI now heh

@ktoso
Copy link
Contributor Author

ktoso commented May 27, 2024

@swift-ci please smoke test

@ktoso ktoso disabled auto-merge May 27, 2024 02:08
@ktoso ktoso force-pushed the pick-concurrency-isCurrent-more-fixes branch from 57158d2 to b90aad2 Compare May 27, 2024 08:02
@ktoso
Copy link
Contributor Author

ktoso commented May 27, 2024

@swift-ci please smoke test

@ktoso
Copy link
Contributor Author

ktoso commented May 28, 2024

@swift-ci please smoke test

@ktoso ktoso merged commit 7eef019 into swiftlang:main May 28, 2024
3 checks passed
@ktoso ktoso deleted the pick-concurrency-isCurrent-more-fixes branch May 28, 2024 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
concurrency Feature: umbrella label for concurrency language features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants