Skip to content

Fix ignored result of size calculation of Exception#560

Closed
jaw wants to merge 1 commit intoeProsima:masterfrom
jaw:bugfix_ignored_size_calculation
Closed

Fix ignored result of size calculation of Exception#560
jaw wants to merge 1 commit intoeProsima:masterfrom
jaw:bugfix_ignored_size_calculation

Conversation

@jaw
Copy link

@jaw jaw commented Feb 19, 2026

Not adding the calculated size to the sum would lead to serialization failing thus rendering certain RPC calls unusable.

Description

To reproduce the bug before this patch solves it, one can use a subset of the RPC example code in fastdds:

IDL code:

module calculator_example
{
    // This exception will be thrown when an operation result cannot be represented in a long
    exception OverflowException
    {
    };

    interface Calculator
    {
        // Returns the result of value1 + value2
        long addition(in long value1, in long value2) raises (OverflowException);
    };
};

Then, in the addition implementation on the server, simply throw OverflowException.

Logs output:

2026-02-18 14:53:40.079 [DATA_WRITER Warning] Data serialization returned false -> Function perform_create_new_change

The message will then never be sent.

@Mergifyio backport 4.2.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • ❌ Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
    • Not sure how to test this...
  • ❌ New feature has been documented/Current behavior is correctly described in the documentation. <!-- Please uncomment following line with the corresponding PR to the documentation project: Bugfix, not feature
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Not adding the calculated size to the sum would lead to
serialization failing thus rendering certain RPC calls unusable.

Signed-off-by: Jonatan Wallmander <jonatan.wallmander@kdab.com>
@jaw jaw force-pushed the bugfix_ignored_size_calculation branch from 9d0f056 to a84e72a Compare February 19, 2026 09:03
@MiKom
Copy link

MiKom commented Feb 19, 2026

Also, separately, the server code generated by fastddsgen could maybe do something about the fact that Replier::send_reply can fail? Right now it just ignores errors:
(code from the calculator example):

    void execute_request(
            const std::shared_ptr<RequestContext>& req)
    {
        try
        {
            for (;;)
            {
                if (req->request.representation_limits.has_value())
                {
                    {
                        ReplyType reply{};
                        reply.representation_limits = calculator_example::detail::Calculator_representation_limits_Result{};
                        reply.representation_limits->result = implementation_->representation_limits(
                            *req);
                        replier_->send_reply(&reply, req->info); //<-- ERROR IGNORED
                    }
                    break;
                }

@jaw jaw closed this Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants