Destroy parallel bulk predecessor values#2119
Open
fallintoplace wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes the parallel scheduler bulk receiver so predecessor values stored for bulk execution have a real lifetime and are destroyed on every terminal path. The old implementation placement-newed a tuple into raw storage and even noted that the tuple was never destroyed, which leaks resources for owning predecessor values.
The storage now uses
__manual_lifetime, destroys the stored tuple before forwardingset_value,set_error, orset_stopped, and adds coverage for value, error, and stopped completion paths. The test uses an owning value that tracks live instances so the old behavior leaves the count non-zero.While adding coverage for value-carrying predecessor senders, the same path also needed a few adjacent fixes that were previously not instantiated by tests:
parallel_schedulerbulk_item_receiver_proxy::execute(size_t, size_t)(count, receiver, scratch)to backendschedule_bulk_*History check: the raw-storage tuple and non-destruction comment were introduced in
b67a1e58whenparallel_schedulermoved into theSTDEXECnamespace, then persisted through later formatting/refactors.Testing
cmake --build build-parallel-scheduler --target test.stdexec -j8./build-parallel-scheduler/test/test.stdexec "bulk on parallel_scheduler destroys stored predecessor values*"./build-parallel-scheduler/test/test.stdexec "[scheduler][parallel_scheduler]"cmake --build build-parallel-scheduler --target test.parallel_scheduler_replacement -j8./build-parallel-scheduler/test/test.parallel_scheduler_replacementgit diff --check upstream/main...HEADNot run locally:
clang-format --dry-run --Werror include/stdexec/__detail/__parallel_scheduler.hpp test/stdexec/schedulers/test_parallel_scheduler.cpp, becauseclang-formatis not installed on this machine.