-
Notifications
You must be signed in to change notification settings - Fork 26
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
👩🌾 what(): Character value exceeds maximum value
benchmark_string_conversions regression
#119
Comments
Add reports from: ros2/rosidl_typesupport_fastrtps#119, ros2/launch_ros#408 Signed-off-by: Crola1702 <[email protected]>
I can reproduce. I don't have a solution yet, but here's what I've found so far.
Run under GDB the relevant part of backtrace:
Frame 9 context Lines 52 to 77 in 4fd7bc3
That value of $ cat asdf.cpp
#include <limits>
#include <iostream>
#include <cstdint>
int main() {
std::cout << std::numeric_limits<uint_least16_t>::max() << "\n";
return 0;
} $ g++ asdf.cpp && ./a.out
65535 |
The test string is the character Lines 67 to 68 in 4fd7bc3
Not sure what the right behavior should be. I'm looking through the changes to see what caused it https://github.com/eProsima/Fast-CDR/compare/1.1.x..2.2.x to see if I can find more info about the change. |
@MiguelCompany mind taking a look? Here's a minimal reproducible example showing the behavior difference between fastcdr 1.1.x and 2.2.x. Which behavior is correct? package.xml<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>cdr_wchar</name>
<version>0.1.0</version>
<description>
Comparing behavior between FastCDR 1.1.x and 2.2.xsd
</description>
<maintainer email="[email protected]">Foo bar</maintainer>
<license file="LICENSE">Apache 2.0</license>
<buildtool_depend>cmake</buildtool_depend>
<depend>fastcdr</depend>
<export>
<build_type>cmake</build_type>
</export>
</package> CMakeLists.txtcmake_minimum_required(VERSION 3.15)
project(cdr_wchar)
find_package(fastcdr REQUIRED CONFIG)
add_executable(wchar-test wchar.cpp)
target_link_libraries(wchar-test fastcdr) wchar.cpp#include <cstdint>
#include <iostream>
#include <string>
#include "fastcdr/Cdr.h"
constexpr const uint64_t kSize = 10;
namespace fastcdr = eprosima::fastcdr;
int main() {
std::wstring foo_wstr(kSize, '*');
std::cout << "foo_wstr is: '";
std::wcout << foo_wstr;
std::cout << "'\n";
char raw_buffer[kSize * 4 + 4]; // 4 bytes per character + 4 bytes for the length
fastcdr::FastBuffer buffer(raw_buffer, sizeof(raw_buffer));
std::cout << "Using FastCDR version " << FASTCDR_VERSION_MAJOR << "." << FASTCDR_VERSION_MINOR << "." << FASTCDR_VERSION_MICRO << "\n";
#if FASTCDR_VERSION_MAJOR == 2
fastcdr::Cdr cdr(buffer, fastcdr::Cdr::DEFAULT_ENDIAN, fastcdr::CdrVersion::XCDRv1);
cdr.set_encoding_flag(fastcdr::EncodingAlgorithmFlag::PLAIN_CDR);
#else
fastcdr::Cdr cdr(buffer, fastcdr::Cdr::DEFAULT_ENDIAN, fastcdr::Cdr::DDS_CDR);
#endif
// Hmm, seems odd that the benchmark setup doesn't ingest the length,
// but the benchmark loop expects the length to be provided.
cdr << foo_wstr;
// Performed in every benchmark loop
cdr.reset();
// from cdr_deserialize
uint32_t len;
cdr >> len;
std::cout << "Got length " << len << "\n";
for (uint32_t i = 0; i < len; ++i) {
uint32_t c;
cdr >> c;
std::cout << c << "\n";
}
return 0;
} Results in this for 1.1.x
And this for 2.2.x
|
From the release notes on v2.0.0: So yes, that behavior changed from 1.x to 2.x. That said, I don't think it affects ROS 2 at all, since it is not using
The only concern would then be the interoperability of One way out of this would be to change the (de)serializer methods to (de)serialize 16-bit chars instead of 32-bit ones. |
What should we do for the benchmark test then? Replace use of Lines 38 to 43 in 4fd7bc3
|
🧑🌾 @sloretz ping jic |
@sloretz Friendly ping |
@sloretz @claraberendsen @Blast545 I went ahead and opened #122 that removes the benchmark tests. |
@MiguelCompany Thank you! |
Bug report
There is a regression that seems to have been introduced by the change implemented #114 that is affecting Rolling and Jazzy benchmark jobs.
This does not seem to be related to the OS change of the J and R jobs to noble, since the first failurereference occurred on a jammy job on Mar 27th a day after of the merge of the PR. It has been consistent since that date.
The error message is:
Test failing
projectroot.benchmark_string_conversions
projectroot.benchmark_string_conversions
Reference builds
Required Info:
Steps to reproduce issue
Run a build of rolling or jammy benchmark jobs
Expected behavior
Tests to pass
Actual behavior
Test fail consistently
The text was updated successfully, but these errors were encountered: