-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use custom allocator from publisher option. #2478
base: rolling
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The related code is introduced by #1557, and that was fine at this moment. then, #1849 changed it to be allocated from stack. that has been addressed by #2443.
all local tests with --packages-select rclcpp
pass.
@clalancette can you take a look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me with green CI.
89ca9da
to
c6234b8
Compare
@thomasmoore-torc windows failure https://ci.ros2.org/job/ci_windows/21402/testReport/junit/(root)/rclcpp/test_publisher_with_type_adapter_gtest_missing_result/ seems that it gets crashed on somewhere in rclcpp/rclcpp/test/rclcpp/test_publisher_with_type_adapter.cpp Lines 367 to 386 in f7a7954
Do you have any clue for that? |
I can not reproduce this failure with linux platform. |
@fujitatomoya - I don't see anything obvious as to why this would fail on the Windows platform. However, I don't readily have access to a Windows-based development environment to try and debug. Did the most recent build fail with the same issues after you forced pushed the additional changes? I haven't discovered how to find those build results and the |
@thomasmoore-torc the same failure. I do not have windows either, i would like to ask some help on this verification. in the meantime, i will take a look what went wrong in the source code. [ RUN ] TestPublisher.test_large_message_unique
-- run_test.py: return code 3221226356
-- run_test.py: generate result file 'C:/ci/ws/build/rclcpp/test_results/rclcpp/test_publisher_with_type_adapter.gtest.xml' with failed test
-- run_test.py: verify result file 'C:/ci/ws/build/rclcpp/test_results/rclcpp/test_publisher_with_type_adapter.gtest.xml' |
@clalancette @alsora any thoughts? |
I think the failing test @fujitatomoya is mentioning was caused by #2443 (check investigation). It's a consistent issue in Windows Debug |
@Crola1702 thanks for the info. I got a question why CI #2443 (comment) on #2443 could not detect this warning on windows? |
This is because CI builds (such as the ones you linked) use sequential executor. Nightly builds are using parallel executor. |
@thomasmoore-torc i think #2498 should fix our CI failure, let me try run CI again. |
Signed-off-by: Tomoya Fujita <[email protected]>
c6234b8
to
5fd47c4
Compare
@fujitatomoya - it looks like that didn't fix it. While it shouldn't be an issue, the implementation of template<>
struct TypeAdapter<std::string, rclcpp::msg::LargeMessage>
{
using is_specialized = std::true_type;
using custom_type = std::string;
using ros_message_type = rclcpp::msg::LargeMessage;
static void
convert_to_ros_message(
const custom_type & source,
ros_message_type & destination)
{
- destination.size = source.size();
- std::memcpy(destination.data.data(), source.data(), source.size());
+ destination.size = std::min(source.size(), destination.data.max_size());
+ std::memcpy(destination.data.data(), source.data(), destination.size);
}
static void
convert_to_custom(
const ros_message_type & source,
custom_type & destination)
{
destination.resize(source.size);
std::memcpy(destination.data(), source.data.data(), source.size);
}
}; |
Signed-off-by: Tomoya Fujita <[email protected]>
I poked at this a bit on my Windows VM, and it really doesn't like the change to In particular, when I built this in Windows Debug, I got the following stack trace:
While I don't know exactly what it means, it suggests to me that |
destination.size = std::min(source.size(), destination.data.max_size()); | ||
std::memcpy(destination.data.data(), source.data(), destination.size); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, while I agree that the old code was dangerous, I think this isn't great either. In particular, if we don't have room in the destination to copy the source in, then we'll copy something truncated, which also seems wrong. Particularly in this test case, I think we should throw an exception if the destination isn't large enough.
address #2477