Repository navigation
Conversation
Co-authored-by: ArivoliR <53344634+ArivoliR@users.noreply.github.com>
Co-authored-by: ArivoliR <53344634+ArivoliR@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor duplicated code for improved maintainability
Refactor duplicated code in resiliency examples and channel classes
Nov 10, 2025
ArivoliR
pushed a commit
that referenced
this pull request
Aug 13, 2026
Two bugs in hpx::serialization::detail::load() for std::exception_ptr: 1. Double-read of archive fields (Bug #1 - data corruption): In the load() function, for hpx_exception and std_system_error types, the err_value and err_message fields were read from the archive twice: once via 'ar & ...' and again via 'ar >> ...'. Since save() writes each field only once, this caused the read cursor to advance by 2x, silently producing garbled error codes and messages in any distributed HPX application that propagates these exception types across localities. Fix: Remove the redundant 'ar & ...' reads; keep only 'ar >> ...' which matches the 'ar << ...' used in save(). 2. Type mismatch for throw_line_ (Bug TheHPXProject#3 - platform-specific corruption): save() declares throw_line_ as 'long' (8 bytes on 64-bit Linux), but load() declared it as 'int' (4 bytes). This caused the serializer to write 8 bytes and the deserializer to read only 4, shifting all subsequent field reads by 4 bytes on affected platforms. Fix: Change 'int throw_line_ = 0' to 'long throw_line_ = 0' in load() to match the type used in save(). Additionally, added a regression test to verify that serialization of hpx::exception, std::system_error, std::runtime_error, and sequential round-tripping behaves correctly. Signed-off-by: arpittkhandelwal <arpitkhandelwal810@gmail.com>
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.
Identified and eliminated ~134 lines of duplicated code across resiliency examples and channel classes.
Changes
Resiliency Examples
universal_ans,validate,mark_faulty_nodes) tolibs/full/resiliency_distributed/examples/common.hppasync_replicate_distributed.cppandasync_replay_distributed.cppnow use shared implementationsChannel Classes
channel_close_mixin<Derived, T>CRTP base class for sharedclose()implementationschannel<T>andsend_channel<T>classesAll public APIs remain unchanged.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.