Skip to content

Commit 2cbf0dc

Browse files
lterracclaude
andcommitted
fix(platform): address CodeRabbit review comments on PR #53
- telephoneGame: call popMessage() after non-root branch consumes message - channelController: return -1 after abort() so argv[1] is never read on bad argc - service: guard memSpaces and computeResources iterators before dereferencing - partition: default _coordinatorInstanceId to 0 (safe for single-node deployments) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 46efca3 commit 2cbf0dc

4 files changed

Lines changed: 11 additions & 5 deletions

File tree

platform/examples/modules/channelController/channelController.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ int main(int argc, char *argv[])
3737
{
3838
fprintf(stderr, "Error: Must provide the config file path.\n");
3939
runtime.instanceManager->abort(-1);
40+
return -1;
4041
}
4142

4243
readAndParseConfiguration(argv, deployment, runtime.instanceManager);

platform/examples/modules/channelController/telephoneGame.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ __INLINE__ void telephoneGame(serving::system::channels::Input &inputChannel,
4343
printf("[Instance %lu][TelephoneGame] Sending message: %s\n", instanceId, text.c_str());
4444
auto output = serving::system::channels::Message(reinterpret_cast<const uint8_t *>(text.data()), text.size(), serving::system::channels::Message::metadata_t{});
4545
outputChannel.pushMessageLocking(output);
46+
inputChannel.popMessage();
4647
}
4748
}

platform/examples/modules/service/service.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,14 @@ int main(int argc, char *argv[])
3131
// Gathering topology from the topology manager
3232
const auto topology = hwlocTopologyManager.queryTopology();
3333

34-
auto d = *topology.getDevices().begin();
35-
auto memSpaces = d->getMemorySpaceList();
36-
auto bufferMemorySpace = *memSpaces.begin();
37-
auto computeResourcesIt = d->getComputeResourceList().begin();
34+
auto d = *topology.getDevices().begin();
35+
auto memSpaces = d->getMemorySpaceList();
36+
if (memSpaces.empty()) HICR_THROW_RUNTIME("No memory spaces found on the queried device");
37+
auto bufferMemorySpace = *memSpaces.begin();
38+
39+
const auto &availableComputeResources = d->getComputeResourceList();
40+
if (availableComputeResources.size() < 2) HICR_THROW_RUNTIME("Fewer than 2 compute resources available");
41+
auto computeResourcesIt = availableComputeResources.begin();
3842

3943
// Use only 2 cores
4044
std::vector<std::shared_ptr<HiCR::ComputeResource>> computeResources;

platform/include/modules/configuration/partition.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class Partition final
7676
private:
7777

7878
std::string _name;
79-
HiCR::Instance::instanceId_t _coordinatorInstanceId;
79+
HiCR::Instance::instanceId_t _coordinatorInstanceId = 0;
8080
std::vector<std::shared_ptr<Task>> _tasks;
8181
std::vector<std::shared_ptr<Replica>> _replicas;
8282
}; // class Partition

0 commit comments

Comments
 (0)