Repository navigation
executors: Guard against sentinel worker index in thread_pool_scheduler_bulk - #8228
shivansh023023 wants to merge 1 commit into
Conversation
…er_bulk Signed-off-by: Shivansh Singh <singhshivansh023@gmail.com>
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Up to standards ✅🟢 Issues
|
Proposed Changes
thread_pool_scheduler_bulk.hpp: Checkslocal_worker_thread != static_cast<std::uint32_t>(-1)before callingrp.get_pu_num(local_worker_thread)indetail::bulk_receiver::execute(), falling back tohpx::threads::find_first(op_state->pu_mask)when invoked from a non-HPX OS thread (matchingindex_queue_spawning_void.hpp).test_bulk_from_os_thread()inlibs/core/executors/tests/unit/thread_pool_scheduler.cpprunningex::bulk(ex::thread_pool_scheduler{}, ex::just(42), 10, ...)viatt::sync_waitfrom astd::threadand verifying the result.Any background context you want to provide?
When
ex::bulk(ex::thread_pool_scheduler{}, ...)is started from a non-HPX OS thread (e.g., astd::threadcallingsync_wait),hpx::get_local_worker_thread_num()returnsstatic_cast<std::size_t>(-1)(0xFFFFFFFFu). Previously,detail::bulk_receiver::execute()passed this sentinel directly torp.get_pu_num(local_worker_thread), causing an assertion failure in Debug builds and an out-of-bounds read /SIGSEGVin Release/RelWithDebInfo builds.Checklist