Commit Graph

8 Commits

Author SHA1 Message Date
Mike Ash
13f479ca61 [6.2][Test] Reduce stack usage in async_taskgroup_discarding_neverConsumingTasks.swift.
With optimizations disabled, the InlineArray initializer uses 512kB of stack space. This can overflow the stack depending on exactly how things are set up. Reduce stack usage by manually allocating memory for the array and initializing it as a pointer to Int.

rdar://153263105
(cherry picked from commit 224dc12063)
2025-06-13 10:08:27 -04:00
Mike Ash
b42c7fa172 [6.2][Concurrency] Fix races/overflows in TaskGroup implementation.
statusCompletePendingReadyWaiting(), offer(), and poll() did a one-off compare_exchange_strong which could fail if the group was concurrently cancelled. Put these into loops so that they are retried when needed.

DiscardingTaskGroup creation passed the group result type as the task result type. waitAll() would then use the group result type when collecting task results. Since the task result type is always Void in this case, this would overflow the result buffer if the group result type was larger. This often works as it writes into the free space of the task allocator, but can crash if it happens to be at the end of a page or the group result type is particularly large.

rdar://151663730
(cherry picked from commit 5be22fa7cc)
2025-05-28 20:59:17 -04:00
Konrad `ktoso` Malawski
439555ab35 [Concurrency] Disable test in freestanding mode 2023-04-20 07:30:05 +09:00
Konrad `ktoso` Malawski
a6e635a34f Update async_taskgroup_discarding_neverConsumingTasks.swift 2023-04-19 22:12:02 +09:00
Konrad `ktoso` Malawski
6139c0c5f8 Re-enable discarding group tests 2023-04-18 12:52:37 +09:00
Artem Chikin
5b662d8ec5 [Concurrency] Fix REQUIRES syntax in disabled TaskGroup tests (#63277) 2023-01-27 16:49:00 -08:00
Dario Rexin
7c9f4aa74c [Concurrency] Disable unstable TaskGroup tests 2023-01-27 15:08:03 -08:00
Konrad `ktoso` Malawski
99fb37f678 [Concurrency] Fix too optimistic TaskGroup bail-out-when-empty, (#63016)
* [Concurrency] Fix too optimistic bail-out-when-empty, discarding group
may need to emit an error out of such waitAll attempt, if a previous
error was already stored.

* [Concurrency] DiscardingTG error thrown from body always wins

* Offering body error must be done while holding lock

* Must not modify waitingTask context outside lock

* wip on trying to fix by changing the offer

* fix bug in resuming tasks in offer/resume task in discarding group

* Fix #63147 waitForAll impl in ThrowingTaskGroup, used to not wait enough

rdar://104507347

* done

* debug

* explicitly declare virtual destructors

* detach child task after filling result; dont mutate context outside of lock

* Add pending count overflow protection to TaskGroup

* unlock async_taskgroup_void_neverConsumingTasks again rdar://104332560

* missing include on windows for error reporting

* fix ARM_ARCH_7K workaround snippet
2023-01-27 19:00:26 +09:00