Skip to content
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

Double Free for DynamicData for Sequences of Nested Structs (with minimal example) #2970

Closed
1 task done
methylDragon opened this issue Sep 22, 2022 · 4 comments
Closed
1 task done
Labels
bug Issue to report a bug

Comments

@methylDragon
Copy link
Contributor

Is there an already existing issue for this?

  • I have searched the existing issues

Expected behavior

  1. Create a dynamic data consisting of a sequence/array of nested structs
  2. Populate that sequence with nested struct elements
  3. Exit cleanly

Current behavior

  1. Create a dynamic data consisting of a sequence/array of nested structs
  2. Populate that sequence with nested struct elements
  3. Exit cleanly <--- Errors print here

Specifically, the following error is printed per sequence/array element created.

[DYN_TYPES Error] Error deleting DynamicData. It isn't registered in the factory -> Function delete_data

Steps to reproduce

I've prepared a minimal example:
methylDragon/fastdds-pr-minimal-examples

Once built, run:

cd build

./src/nested-sequences-bug/could_not_delete

The relevant code can be found here.

Fast DDS version/commit

FastDDS 2.8.x: 78473a0

The examples workspace is using that specific SHA in the submodule, for convenience.

Platform/Architecture

Other. Please specify in Additional context section.

Transport layer

Default configuration, UDPv4 & SHM

Additional context

This is on 22.04, but I don't think the platform matters in this case.

The error is being emitted from DynamicDataFactory's destructor call.

What I suspect is happening is, as each dynamic data is added to the sequence/array, the data gets registered once to the factory on creation. But on destruction, the factory destroys the instance, but the sequence/array destruction triggers a second destruction.

This causes the double free. (I think)

XML configuration file

No response

Relevant log output

nested_sequence: 
	[0] = <struct/bitset>
		inner_uint32: 1

	[1] = <struct/bitset>
		inner_uint32: 2

2022-09-22 16:04:48.127 [DYN_TYPES Error] Error deleting DynamicData. It isn't registered in the factory -> Function delete_data
2022-09-22 16:04:48.127 [DYN_TYPES Error] Error deleting DynamicData. It isn't registered in the factory -> Function delete_data


### Network traffic capture

_No response_
@methylDragon
Copy link
Contributor Author

This bug is still happening, are there any updates?

@methylDragon
Copy link
Contributor Author

methylDragon commented Mar 24, 2023

If it helps, I found that commenting out this line fixes the issue. But I don't know what the fallout of removing default_array_value_ is.

This issue happens when dynamic datas are copied with DynamicDataFactory::create_copy(). But I'm not sure what exactly is happening.

@JLBuenoLopez
Copy link
Contributor

There are several known issues related with Dynamic Types in Fast DDS. Thus, a refactor is being undertaken in order to fix the Dynamic Types implementation. It is expected to be released with Fast DDS v2.11.0 scheduled for June 2023.

@JLBuenoLopez JLBuenoLopez linked a pull request Apr 13, 2023 that will close this issue
13 tasks
@JLBuenoLopez JLBuenoLopez added bug Issue to report a bug and removed triage Issue pending classification labels Apr 13, 2023
@elianalf
Copy link
Contributor

The Dynamic Types refactor has been integrated in Fast DDS v3.0.0 which will be released soon. This issue may be solved in the new version of Fast DDS, so I will close this issue for now. If the issue persists, feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue to report a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants